Stdin Package Description
package require stdin
The stdin package provides a text console for entering Tcl
commands to tclsh while allowing it to be event driven.
To access the stdin package, include the code:
in your script, and start the tcl event loop (and the stdin console)
that takes as an optional argument, a command prompt string.
In addition to providing normal command entry, stdin provides
a rudimentary command history, loosely inspired from csh.
Any command that begins with (!) is looked up in the history list,
allowing a previous command to be re-executed. The general for of a
history command is:
match-expression is a regular expression that is used to find the most
recent command in the history list to re-executed. By default, this
expression is anchored at the beginning of the line, so the command:
will re-execute the most recent command that begins with "s".
will re-execute the most recent command that begins with "s" and also contains
the letter "q".
The re-issued command is inserted onto the history list.
is optional, and permits part of a previous command to be re-issued with
modifications. The replace-expression is a regular expression that
matches some portion of the command string, which is then replaced by
replacement-string before the command is re-issued.
When a substitution succeeds, both the original command matched and the
modified version are displayed on the console.
As an example, if the command:
is the most recent command on the history list beginning with "s", then:
would run the command:
State for the stdin package is stored in the global array: