Finish integrated command-line help system.
This commit is contained in:
parent
9a438758b3
commit
d44dc759fc
2 changed files with 16 additions and 5 deletions
|
@ -46,7 +46,10 @@
|
||||||
|
|
||||||
(command-line
|
(command-line
|
||||||
print-help
|
print-help
|
||||||
(-h "This help" () (print "help") (print-help) (print "done") (exit 0))
|
(-h "This help" ()
|
||||||
|
(print "Command-line options:")
|
||||||
|
(print-help)
|
||||||
|
(exit 0))
|
||||||
(-a "One-argument" (x) (print "Argument x " x))
|
(-a "One-argument" (x) (print "Argument x " x))
|
||||||
(-b "Two arguments" (x y) (print "Arguments " x y))
|
(-b "Two arguments" (x y) (print "Arguments " x y))
|
||||||
(-c "Argument lambda" (lambda (x) (print "Lambda x " x))))
|
(-c "Argument lambda" (lambda (x) (print "Lambda x " x))))
|
||||||
|
|
|
@ -100,10 +100,18 @@
|
||||||
descrs))))
|
descrs))))
|
||||||
(let loop ((descrs descrs))
|
(let loop ((descrs descrs))
|
||||||
(when (not (null? descrs))
|
(when (not (null? descrs))
|
||||||
(let ((desc (car descrs)))
|
(let* ((desc (car descrs))
|
||||||
(print (car desc)
|
(opt (car desc))
|
||||||
(cadr desc)
|
(args (cadr desc))
|
||||||
(caddr desc))
|
(help (caddr desc)))
|
||||||
|
(print " "
|
||||||
|
opt
|
||||||
|
(make-string (- owidth (string-length opt)) #\space)
|
||||||
|
" "
|
||||||
|
args
|
||||||
|
(make-string (- awidth (string-length args)) #\space)
|
||||||
|
" "
|
||||||
|
help)
|
||||||
(loop (cdr descrs)))))))
|
(loop (cdr descrs)))))))
|
||||||
|
|
||||||
;; Syntax for expanding various types of options.
|
;; Syntax for expanding various types of options.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue