Init:
PROC = {
Register:
PROC [name:
LONG
STRING, proc: Commander.CommandProc, doc:
LONG
STRING, data:
REF ¬
NIL, un:
BOOL ¬
FALSE] = {
Commander.Register[ConvertUnsafe.ToRope[name], proc, ConvertUnsafe.ToRope[doc], data, NOT un];
};
Register["GetProperties", PropertiesCommand, "Display command tool property list"];
Register["GetProcessProperties", PropertiesCommand, "Display process properties list", $ProcessProperties];
Register["SetProperty", SetPropertyCommand, "SetProperty propertyName value - change or add to the command tool property list"];
Register["SetProcessProperty", SetPropertyCommand, "SetProperty propertyName value - change or add to the process property list", $ProcessProperties];
Register["SetListProperty", SetPropertyCommand, "SetProperty propertyName elt elt ... - bind propertyName in the command tool property list to the LIST OF ROPE = [elt, elt, ...]", $List];
Register["SetListProcessProperty", SetPropertyCommand, "bind propertyName in the process property list to the LIST OF ROPE = [elt, elt, ...]", $ListProcessProperties];
Register["-", CommentCommand, "Comment", NIL, TRUE];
Register["--", CommentCommand, "Comment", NIL, TRUE];
Register["/", CommentCommand, "Comment", NIL, TRUE];
Register["//", CommentCommand, "Comment", NIL, TRUE];
Register["?", RegisteredHelpCommand, "List registered commands"];
Register["Abort", AbortCommand, "Abort -- Raises ABORTED"];
Register["Alias", AliasCommand, "Define a new command in terms of others, using blind string-matching for parameters.", NIL, TRUE];
Register["Aliases", AliasesCommand, "List all Aliases"];
Register["Answerback", AnswerbackCommand, "reads result and msg from command line"];
Register["Date", DateCommand, "Print date and time"];
Register["Echo", EchoCommand, "Print command line arguments\n\t-s supress whitespace\n\t-n no newline"];
Register["ERROR", ErrorCommand, "Error -- Raises unnamed ERROR"];
Register["Fail", FailCommand, "This command always fails"];
Register[";", FailSkipCommand, "Skip on failure"];
Register["Help", RegisteredHelpCommand, "List registered commands"];
Register["Indent", IndentCommand, "Indent n -- Indent n spaces", $Indent];
Register["PrefixLines", IndentCommand, "PrefixLines <string> - prefix each line of stdin with <string>", $PrefixLines];
Register["PrevResult", PrevResultCommand, "- print the result of the previous command"];
Register["ResultOf", ResultOfCommand, "<command> - print the result of the given command (uninterpreted)", NIL, TRUE];
Register["ReadTo", IndentCommand, "ReadTo <string> - Copy stdin to stdout until a line with just <string> is encountered.", $ReadTo];
Commander.Register["Synonym", ReregisterAsCommand, usageReregisterAs, NIL, TRUE];
Register["Shift", ShiftCommand, "Shift command-line (uninterpreted)", NIL, TRUE];
Register["ShiftInterp", ShiftCommand, "ShiftInterp command-line (interpreted)"];
Register["Command", ShiftCommand, "do command-line as a command"];
Register["Commander", CommanderCommand, "Make a nested commander"];
Register["Sleep", SleepCommand, "Sleep n -- pause for n seconds"];
Register["Time", TimeCommand, "Time command-line (uninterpreted)", NIL, TRUE];
Register["Unregister", UnregisterCommand, "Unregister commands\nUsage: Unregister commandname ..."];
Register["Verbose", ControlCommand, "Control command tracing (inverse of Terse)\nUsage: Verbose [locally] [on|off|toggle|?]", $Verbose];
Register["Terse", ControlCommand, "Control command tracing (inverse of Verbose)\nUsage: Terse [locally] [on|off|toggle|?]", $Terse];
Register["Statistics", ControlCommand, "Control statistics printing\nUsage: Statistics [locally] [on|off|toggle|?]", $Statistics];
Register["HistoryLog", ControlCommand, "Control history logging\nUsage: HistoryLog [locally] [on|off|toggle|?]", $HistoryLog];
Register["Version", VersionCommand, "Print Cedar version number"];
Register["ForegroundPriority", PriorityCommand, "(uninterpreted) Execute rest of command line at foreground priority", $Foreground, FALSE];
Register["BackgroundPriority", PriorityCommand, "(uninterpreted) Execute rest of command line at background priority", $Background, FALSE];
Register["NormalPriority", PriorityCommand, "(uninterpreted) Execute rest of command line at normal priority", $Normal, FALSE];
Commander.Register[key: "Redo", proc: RedoCommand, doc: "Redo <string> — redoes the last command that begins with string"];
Commander.Register[key: "History", proc: HistoryCommand, doc: "History <option>* <n> — lists the last n commands in this CommandTool viewer\n -% omit % prompt\n +% include % prompt\n -d remove duplicate commands\n +d include duplicates"];
Commander.Register["Prop", PropCommand, docPropCommand];
Commander.Register["Map", MapCommand,
"maps the first argument as a command over the other arguments
-a return failure if any command fails
-e return failure if every command fails
-q quit on failure, return failure
-s quit on success, return success
"];
};