(guile.info.gz) getopt-long
Info Catalog
(guile.info.gz) Command Line Args
(guile.info.gz) Command Line Handling
10.2 The (ice-9 getopt-long) Module
===================================
A script is free to parse and handle its command line arguments in any
way that it chooses. Where the set of possible options and arguments is
complex, however, it can get tricky to extract all the options, check
the validity of given arguments, and so on. This task can be greatly
simplified by taking advantage of the module `(ice-9 getopt-long)',
which is distributed with Guile.
The `(ice-9 getopt-long)' module exports two procedures:
`getopt-long' and `option-ref'.
* `getopt-long' takes a list of strings -- the command line
arguments -- and an "option specification". It parses the command
line arguments according to the option specification and returns a
data structure that encapsulates the results of the parsing.
* `option-ref' then takes the parsed data structure and a specific
option's name, and returns information about that option in
particular.
To make these procedures available to your Guile script, include the
expression `(use-modules (ice-9 getopt-long))' somewhere near the top,
before the first usage of `getopt-long' or `option-ref'.
Menu
* getopt-long Example A short getopt-long example.
* Option Specification How to write an option specification.
* Command Line Format The expected command line format.
* getopt-long Reference Full documentation for `getopt-long'.
* option-ref Reference Full documentation for `option-ref'.
Info Catalog
(guile.info.gz) Command Line Args
(guile.info.gz) Command Line Handling
automatically generated byinfo2html