summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2022-02-08 11:39:35 +0000
committerKaz Kylheku <kaz@kylheku.com>2022-02-08 08:08:08 -0800
commit587194b81ba2da80b5598567914c9ddc9a124208 (patch)
tree31619feeb2b27ae52cabd1f8375a1fc60d93b281
parentbf9105a392fdfad882f8b47544f607ef77674e61 (diff)
downloadtxr-587194b81ba2da80b5598567914c9ddc9a124208.tar.gz
txr-587194b81ba2da80b5598567914c9ddc9a124208.tar.bz2
txr-587194b81ba2da80b5598567914c9ddc9a124208.zip
getopts: uniformize opthelp newlines and headers.
The documented options and type legend both end in a blank line, unlike the undocumented options and option conventions. * stdlib/getopts.tl (opthelp): Print a blank line after the undocumented options. (opthelp-conventions): Print a blank line after the conventions. Also, change the header from "Option Conventions" to "Option conventions" to follow the style of the undocumented options and type legend. * txr.1: Remove superfluous (as of now) put-line calls in the --extra-help example of getopts. While here, correct o.extrahelp to o.extra-help.
-rw-r--r--stdlib/getopts.tl8
-rw-r--r--txr.16
2 files changed, 7 insertions, 7 deletions
diff --git a/stdlib/getopts.tl b/stdlib/getopts.tl
index 06cc514c..bb3f394b 100644
--- a/stdlib/getopts.tl
+++ b/stdlib/getopts.tl
@@ -306,12 +306,13 @@
(flatten (mappend (op list @1.short @1.long)
undocumented))] ", "}`))
(each ((line (sys:wdwrap undoc-str 75)))
- (put-line ` @line`))))))
+ (put-line ` @line`)))
+ (put-line))))
(defun opthelp-conventions (opt-desc-list : (*stdout* *stdout*))
(let ((documented (remove-if (op null @1.helptext) opt-desc-list))
(undocumented (keep-if (op null @1.helptext) opt-desc-list)))
- (put-line "Option Conventions:\n")
+ (put-line "Option conventions:\n")
(let* ((have-short (some documented (usl short)))
(have-long (some documented (usl long)))
(have-arg-p (some documented (usl arg-p)))
@@ -355,7 +356,8 @@
arguments which follow are not treated as options\ \
even if they look like options.")))
(mapdo (do put-line ` @1`)
- (sys:wdwrap `@{(flatten texts)}` 77)))))
+ (sys:wdwrap `@{(flatten texts)}` 77)))
+ (put-line)))
(defun opthelp-types (opt-desc-list : (*stdout* *stdout*))
(let ((documented (remove-if (op null @1.helptext) opt-desc-list)))
diff --git a/txr.1 b/txr.1
index 465b5aa6..5d8571c1 100644
--- a/txr.1
+++ b/txr.1
@@ -68332,14 +68332,12 @@ macro:
(let ((o (new prog-opts)))
o.(getopts *args*)
- (when (or o.help o.extrahelp)
+ (when (or o.help o.extra-help)
(put-line "Usage:\en")
(put-line ` @{prog-name} [options] arg*`)
o.(opthelp)
- (when o.extrahelp
- (put-line)
+ (when o.extra-help
o.(opthelp-types)
- (put-line)
o.(opthelp-conventions))
(exit -1))
(put-line `args after opts are: @{o.out-args ", "}`))