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:
-delimiter characters; example:
=delimiter character followed by a long–option–argument is accepted; example:
--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
Preliminary versions of this interface are already available for some Scheme implementations: here for Chicken, and here for Scsh.