Next: srfi args-fold spec, Previous: srfi args-fold abstract, Up: srfi args-fold [Index]
Program arguments are the primary interface to many programs, so processing arguments is a common programming task. There are many common (often conflicting) ways take care of this task, so a custom processor is often necessary; however, many programmers (and their users) would welcome a convenient interface supporting common guidelines.
POSIX provides several guidelines for the specification of program options, option–arguments, and operands. It also notes historical exceptions to these guidelines. The GNU C Library Reference Manual describes long option extensions to the POSIX guidelines.
This SRFI supports creating programs following the guidelines mentioned above by:
It parses argument strings according to the following rules:
-
delimiter character; examples: -a
,
-bcd
;
-a foo
,
-bcd bar
;
-afoo
, -bcdbar
;
-
delimiter characters; example: --help
;
=
delimiter character followed by a long–option–argument is accepted;
example: --speed=fast
;
--
argument string is accepted as a delimiter
indicating the end of options; it is not treated as an option or an
operand; any argument strings following this delimiter are treated as
operands, even if they begin with the -
character;
Preliminary versions of this interface are already available for some Scheme implementations: here for Chicken, and here for Scsh.
Next: srfi args-fold spec, Previous: srfi args-fold abstract, Up: srfi args-fold [Index]