Changeset 33351 in project


Ignore:
Timestamp:
05/26/16 20:52:43 (3 years ago)
Author:
Ivan Raikov
Message:

clarified documentation for value options (thanks to nxg)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/getopt-long

    r28892 r33351  
    3838; {{(single-char CHAR)}} : Accept {{-CHAR}} as a single-character equivalent to {{--OPTION}}.  This is how to specify traditional Unix-style flags.
    3939; {{(required BOOL)}} : If {{BOOL}} is true, the option is required. {{getopt-long}} will raise an error if it is not found in the list of arguments.
    40 ; {{(value FLAG [(PROPERTY VALUE) ...])}} : If {{FLAG}} is {{#t}}, the option requires a value; if it is {{#f}}, it does not; if it is of the form {{(REQUIRED name)}} then the option requires and the name is used by the usage procedure if it is of the form {{(OPTIONAL name)}} the option may appear with or without a (named) value.
     40; {{(value FLAG)}} : If {{FLAG}} is {{#t}}, the option requires a value; if it is {{#f}}, it does not.
     41; {{(value (REQUIRED "name") [(PROPERTY VALUE) ...])}} : If {{FLAG}} is {{#t}}, the option requires a value; if it is {{#f}}, it does not; if it is of the form {{(REQUIRED name)}} then the option requires a value and the name is used by the usage procedure.
     42; {{(value (OPTIONAL "name") [(PROPERTY VALUE) ...])}} : the option may appear with or without a named value.
    4143
    4244In addition, the following properties can be defined for a value:
    4345
    44 ; {{(predicate FUNC)}} : If the option accepts a value (i.e. you specified {{(value #t)}} for this option), then {{getopt-long}} will apply {{FUNC}} to the value, and throw an exception if it returns {{#f}}.  {{FUNC}} should be a procedure which accepts a string and returns a boolean value; you may need to use quasiquotes to get it into the grammar.
     46; {{(predicate FUNC)}} : If the option accepts a value (i.e. you specified {{(REQUIRED ...)}} or {{(OPTIONAL ...)}} for this option), then {{getopt-long}} will apply {{FUNC}} to the value, and throw an exception if the result is {{#f}}.  {{FUNC}} should be a procedure which accepts a string and returns a boolean value; you may need to use quasiquotes to get it into the grammar.
    4547; {{(transformer FUNC)}} : If the option accepts a value, then getopt will apply FUNC to the string provided on the command line, and put the resulting value in the list of parsed options returned by getopt-long.
    4648
Note: See TracChangeset for help on using the changeset viewer.