[[tags: egg]] == SRFI 193 [[toc:]] === Introduction This egg implements [[https://srfi.schemers.org/srfi-193/srfi-193.html|SRFI 193: Command line]]. === Documentation ==== Command (command-line [string-list]) Like the standard {{command-line}} procedure in R7RS and R6RS, this gives 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. Unlike RnRS {{command-line}}, this is a parameter that can be bound to another value by the Scheme programmer if desired, for example for subcommand processing. The value of this parameter should be a list of one or more strings at all times. Neither the strings nor the list should be mutated. If the parameter is rebound to another list, the new list is permitted to share structure with the old list. The default value of the parameter is more precisely specified than the value of RnRS {{command-line}}. When evaluating code in the csi REPL, the command line is a one-element list whose only element is a zero-length string. When running a standalone program compiled via 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. (command-name) Returns a simplified version of {{(car (command-line))}}, respecting the current binding of the {{command-line}} parameter. This is typically something suitable to display as the program name. For example, {{/path/to/foo.scm}} is simplified into {{foo}}. However, if {{(car (command-line))}} is a zero-length string (such as at the csi REPL), {{#f}} is returned to signify "not a command". (command-args) Returns {{(cdr (command-line))}}, respecting the current binding of the {{command-line}} parameter. ==== Script (script-file [string?]) If running a Scheme source file in csi, returns an absolute pathname of that file as a string. Otherwise returns {{#f}}. In Chicken, this is actually a parameter object and may be set by the user. (script-directory) Returns {{(script-file)}} without the filename part, respecting the current binding of the {{script-file}} parameter. Returns {{#f}} in any situation where {{(script-file)}} returns {{#f}}. Returned strings end with a directory separator so {{string-append}} can be used to build pathnames to refer to files in the same directory as the script. === Version History * 0.1: First release. === Author Lassi Kortela === Repository [[https://github.com/lassik/chicken-srfi-193|https://github.com/lassik/chicken-srfi-193]] === License Copyright 2020 Lassi Kortela Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.