Next: guile-tools api-diff, Previous: HVQC-MAIN, Up: Miscellaneous Tools
See Executable Modules, for discussion.
Usage: PROGRAM [ARGS]
PROGRAM does nothing when invoked from the shell.
Optional arg "--version" means display version only.
Optional arg "--help" means display help only.
Usage from a Scheme program:
(HVQC-MAIN args callback . config)
This procedure abstracts "--help", "--version", getopt-long interaction
(using a "query op") and callback calling, in configurable ways.
ARGS is a list of strings taken from the command line. CALLBACK is a
procedure w/ one of two signatures depending on what CONFIG is. CONFIG
is a list of key/value pairs for customizing behavior. These keys are
recognized:
package -- a string describing program affiliation (for "--version")
version -- a string to use instead of Guile's version
usage -- use instead of default usage message (a string is used
directly, the symbol `commentary' means extract usage info
from the program file's Commentary section, a thunk is
called for its string return value)
option-spec -- a specification suitable for use w/ `getopt-long'
If CONFIG includes `option-spec', pass ARGS and the specification to
`getopt-long', construct a closure QOP (query options) that encapsulates
the parse results, and do: (CALLBACK QOP). QOP takes a key and an optional
proc; if the key results in a non-#f value, call PROC on that value (or
`identity' if no proc specified) and return the result. If the key's value
is #f, QOP returns that. QOP handles these keys specially:
#:full-args -- return the full arg list (similar to `command-line')
#:parsed-full -- return the full results of `getopt-long' parsing
#:parsed-opts -- similar to #:parsed-full but omit the '() entry
If CONFIG does not include `option-spec', do: (CALLBACK ARGS).
Usage for New Programs:
(0) Read the friendly manual.
(1) Figure out the name of the new script, say "my-prog".
(2) $ guile-tools --source PROGRAM | sed s/PROGRAM/my-prog/g > my-prog
(3) $ chmod +x my-prog
(4) Edit my-prog to taste (don't miss the NB! notes).