Next: getopts conditions, Previous: getopts config, Up: getopts [Index]
Parse the Scheme strings in the list command-line as command line
arguments, according to the options described by the list options
of command-line-option records. If the configuration option
delayed is not used, the return value is #f.
argument-action must be a Scheme function accepting a single argument: a Scheme string representing a command line non–option.
The optional config-options must be an enumerated set of values
from the getopts-configuration enumeration.
Meaningless usage example:
(import (vicare)
(vicare getopts)
(only (vicare language-extensions syntaxes)
set-cons!))
(define result #f)
(define (register-with opt val)
(set-cons! result (list (command-line-option-long opt) val)))
(define (register-without opt)
(set-cons! result (list (command-line-option-long opt))))
(define (register-non-option arg)
(set-cons! result arg))
(define-command-line-option interactive
(brief #\i)
(long "interactive")
(requires-argument #f)
(description "ask the user first")
(action register-without))
(define-command-line-option force
(brief #\f)
(long "force")
(requires-argument #f)
(description "hurt me plenty")
(action register-without))
(define-command-line-option help
(brief #\h)
(long "help")
(requires-argument? #f)
(description "print help screen")
(action register-without))
(define-command-line-option file
(brief #\F)
(long "file")
(requires-argument #t)
(description "input file")
(action register-with))
(define-command-line-option archive
(brief #\A)
(long "archive")
(requires-argument #t)
(description "output archive")
(action register-with))
(getopts (command-line)
(list interactive force help file archive)
register-non-option
(getopts-options ignore-multiple-double-dashes))