Terminal Input

Source: standard-library. Raw markdown: /raw/docs/standard-library/4-plugins/terminal-input.md

Terminal Input

The terminal-input plugin controls terminal input listening and emits line events through Simorg vibrations. Actions are routed by key and invalid actions result in no vibration.

Functions


start

Starts terminal input loop with a default terminal prompt string, prints the prompt, then reads a line when the user presses enter. Registers onReadLine listener for subsequent lines.

"> "  terminal-input.start ? // 1

Calling start repeatedly keeps listener active and returns start status.

"> "  terminal-input.start ? // 1

Non-string start value is rejected.

true  terminal-input.start ? // no vibration
  • Type: ERROR
  • Code: INVALID_ARGUMENT
  • Message: start expects a string default terminal prompt.

stop

Stops terminal input loop.

terminal-input.stop ? // no vibration

Stopping when not running still completes safely with no vibration.

terminal-input.stop ? // no vibration

onReadLine

Event emitted when a new terminal line is read while input manager is running.

terminal-input.onReadLine ? // "user typed text"

If input manager is stopped, no line event is emitted.

terminal-input.onReadLine ? // no vibration