chickadee » easy-args » define-arguments

(define-arguments (name [value [guard]]) ...)syntax

define-arguments defines parameter objects for the given command line option names and sets them according to the program's command-line-arguments parameter.

For each specified argument, name should be an identifier or list of identifiers. The first of these will be bound to the newly-created parameter object. value, if given, must be a boolean, string, number or symbol, and will be the default value of the parameter object. If no value is given, #f is used. If a procedure guard is given, it is used as the parameter object's conversion procedure.

Each name, when prefixed by one dash (in the case of a single-character identifier) or two (for all others), will be used as a command-line flag to set the corresponding parameter object's value. If name contains asterisks, they are stripped from the flag.

define-arguments reads and modifies Chicken's command-line-arguments parameter, setting matched parameter objects to the specified values and removing their options from the list. Unmatched arguments are accumulated into an alist accessible by the unmatched-arguments procedure. Upon completion, command-line-arguments will contain any non-option arguments to the program. The return value is unspecified.