Add man page for main-args.lsp
authorRalph Ronnquist <ralph.ronnquist@gmail.com>
Sun, 23 Apr 2023 06:12:25 +0000 (16:12 +1000)
committerRalph Ronnquist <ralph.ronnquist@gmail.com>
Sun, 23 Apr 2023 06:12:25 +0000 (16:12 +1000)
Makefile
main-args.lsp.8.adoc [new file with mode: 0644]

index d78aa42ea97421e5d5deb8ce959d48ee128d2967..723eef266994717c82eff3611f6070655c96d9dd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all: packnl packnl.8 incore.lsp.8
+all: packnl packnl.8 incore.lsp.8 main-args.lsp.8
 
 packnl: packnl.lsp incore.lsp main-args.lsp
        newlisp -x incore.lsp $@
diff --git a/main-args.lsp.8.adoc b/main-args.lsp.8.adoc
new file mode 100644 (file)
index 0000000..b34850b
--- /dev/null
@@ -0,0 +1,62 @@
+= main-args.lsp(8)
+:doctype: manpage
+:revdate: {sys:date "+%Y-%m-%d %H:%M:%S"}
+
+== NAME
+
+main-args.lsp - a newlisp module for simple main-args processing
+
+== SYNOPSIS
+
+====
+(*constant* '*OPTIONS* ( _MATCH_* ) ) +
+(*load* "main-arg.lsp")
+====
+
+== DESCRIPTION
+
+This newlisp module implements simple command line processing to
+extract options with arguments. When loaded it processes a
+pre-assigned _OPTIONS_ vaiable to replace its list of possible options
+with the list of actual matches.
+
+Each _MATCH_ is a _match_ pattern consisting of "option string" to
+match and question mark symbols to mark any argument for that option.
+For example, a _MATCH_ like _("-a" ?)_ will match against a "-a"
+option and a subsequent option value.
+
+The _OPTIONS_ constant is reassigned with the actual command line
+options and values.
+
+=== main-args.lsp API
+
+*ARGS*::
+
+This variable holds any remaining command line arguments when options
+have been matched.
+
+*OPTIONS*::
+
+This variable should be set up before loading *main-args.lsp* to
+declare which the command line options are, and it becomes replaced
+with an association list of the actual command line options.
+
+== EXAMPLE
+
+.The following example is from _packnl_
+----
+(constant 'OPTIONS
+    '(("-w" ?)   ; write new file
+      ("-u" ? ?) ; unpack members to given directory
+      ("-t" ?)   ; merely list packed members of
+      ))
+(load "main-args.lsp")
+----
+
+== SEE ALSO
+
+*newlisp*
+
+== AUTHOR
+
+Ralph.Ronnquist <ralph.ronnquist@gmail.com>