From 41f94edaf0505e5b661877a9456d26de04b4d16b Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Sun, 23 Apr 2023 16:12:25 +1000 Subject: [PATCH] Add man page for main-args.lsp --- Makefile | 2 +- main-args.lsp.8.adoc | 62 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 main-args.lsp.8.adoc diff --git a/Makefile b/Makefile index d78aa42..723eef2 100644 --- 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 index 0000000..b34850b --- /dev/null +++ b/main-args.lsp.8.adoc @@ -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 -- 2.39.2