chickadee » srfi-193 » command-line

command-line #!optional string-listparameter

Like the standard command-line procedure in R7RS and R6RS, this returns the command line as list of strings. The first element (always present) is the command name and the remaining elements (if any) are command arguments. Neither the strings nor the list should be mutated.

Unlike RnRS command-line this is a parameter that can be bound to another value, e.g. for subcommand processing. If the parameter is rebound to another list, the new list may share structure with the old list.

The initial command line is more precisely specified than the value of RnRS command-line:

  • When running a standalone program compiled by csc, the first element is the operating system's argv[0] and the remaining elements are argv[1] and up. However, any -: arguments that give options for the Chicken runtime system are not part of the list.
  • When running a script via csi -script file.scm a b c or csi -s file.scm a b c then command-line is bound to '("file.scm" "a" "b" "c").
  • When not running a command, command-line is bound to '(""). This happens when:
    • Loading source files into the csi REPL via csi file.scm.
    • Loading source files into the csi REPL via (load "file.scm").
    • Evaluating code in the csi REPL.