Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.
Next: SRFI Support, Previous: Web, Up: Guile Modules [Contents][Index]
The (ice-9 getopt-long)
facility is designed to help parse
arguments that are passed to Guile programs on the command line, and is
modelled after the C library’s facility of the same name
(see Getopt in The GNU C Library Reference Manual). For a more
low-level interface to command-line argument parsing, See SRFI-37.
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 — an option specification, and some optional keyword
parameters. It parses the command line arguments according to the
option specification and keyword parameters, 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
.
• 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 .
|