Use

At the prompt, you can type any CircuitScheme (Lisp-like) expression and the interpreter will provide the result. 

If you need to change a typed-in expression, you don't have to type it over. You can use all the editing keys below to work with the text. This is good, as Lisp syntax can be picky as to things, especially parentheses!

CircuitScheme has built-in commands for working with Adafruit M4 board inputs and outputs. You can try those out.

Again, as this is a fairly generalized command line interpreter, you can reuse the code to add CLI capabilities into your own project.

Key Controls for Editing within the Command Line Interpreter

The notation of Ctrl-a to denote pressing the a key while holding down Control is used here.

Movement

Attempts to move past either end of the line causes the terminal bell to ring.

By character

To move one character to the left (toward the start of the line), use the left-arrow key.

To move one character to the right (toward the end of the line), use the right-arrow key.

By word

A word is considered to be a series of non-space characters surrounded by spaces, or the start/end of the line.

To move one word to the left, use Ctrl-b.

To move one word to the right, use Ctrl-f.

Ends of the line

To move to the beginning of the line, use Ctrl-a.

To move to the end of the line, use Ctrl-e.

History

As each line is entered, it is added to the history if the history is empty or the line differs from the most recent one in the history. Attempts to move beyond the available history causes the terminal bell to ring.

To move to the previous line in the history, use the up-arrow key.

To move to the next line in the history, use the down-arrow key.

Repeated use of these keys will move through the history. Moving to a history item copies it to the input line, moving the cursor to the end of the line. After entering a line, the history pointer moves to before the most recent entry (so pressing up-arrow pulls out the line just entered).

Deletion

There are three ways to delete characters from the line being edited.

Ctrl-d deletes the character under the cursor (sometimes called forward delete). Nothing happens if the cursor is at the end of the line.

Either Back-Space or DEL act as backspace is expected to: deleting the character to the left of the cursor. Nothing happens if the cursor is at the beginning of the line.

To delete the rest of the line use Ctrl-k. This deletes the character under the cursor and all characters to the right of the cursor (i.e. to the end of the line).

Multiple line support

If you enter a line that is incomplete you will be prompted for more by the use of a continuation prompt: ... rather than the usual ==>. This will continue until all input is accumulated. In the case of CircuitScheme, this is a legal Lisp expression.

Note that you can't edit a prior line in a multiline input, although you can use history on both primary and continuation lines.

This guide was first published on Feb 20, 2019. It was last updated on Feb 20, 2019.

This page (Usage) was last updated on Nov 04, 2020.