diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-03 20:56:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-03 20:56:47 -0700 |
commit | 7ccd643ac222d3da563b386cef5caf7af1b79363 (patch) | |
tree | f370b15e162259da08afe318777f034ae5dff72e /txr.1 | |
parent | 935f58e8941f03590bbd5c8482a31b50cf233802 (diff) | |
download | txr-7ccd643ac222d3da563b386cef5caf7af1b79363.tar.gz txr-7ccd643ac222d3da563b386cef5caf7af1b79363.tar.bz2 txr-7ccd643ac222d3da563b386cef5caf7af1b79363.zip |
Support simple list arguments in getopts.
* share/txr/stdlib/getopts.tl (defstruct sys:opt-parsed): New
slot eff-type, appearing as an optional parameter in the boa
constructor parameter list.
(opt-desc check): Allow a type to be a cons with list
in the car position.
(sys:opt-parsed convert-type): Use the eff-type slot
if it is set instead of the type from the descriptor.
This lets us override the type for a slot, which is
key to the recursive approach to how lists are handled
in this same function.
(opthelp): Show list type options in a visual way
which suggests the use. No details are given.
* txr.1: Documented list option type.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -41538,12 +41538,25 @@ or .code E followed by a decimal integer which may have a leading positive or negative sign, and include leading zeros. - .coIP :str This type indicates that the argument consists of the interior notation of a TXR Lisp character string. It is processed by adding a double quote at the beginning or end, and parsed as a string literal. This parsing must successfully yield a string object, otherwise the argument is ill-formed. +.meIP (list << type ) +If the type is specified as a compound form headed by the +.code list +symbol, it indicates that the command line option's argument is a list +of elements. The argument appears on the command line as a single string +contained within one argument. It may contain commas, and is split into pieces +using the comma character as a separator. The pieces are then individually +treated as of type +.meta type +and converted accordingly. The option's argument is then a list object +whose elements are the converted pieces. For instance +.code "(list :dec)" +will convert a list of comma-separated decimal integer tokens into +a list of integer objects. .RE .PP |