From 443a66458ff2e2716cbc67ba10fe9c71b0ed3fcd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 16 Jul 2017 22:05:00 -0700 Subject: getopts: New argument type :text. * share/txr/stdlib/getopts.tl (opt-desc): New entry in valid-types, :text symbol. (sys:opt-parsed convert-type): Handle :text case. This is a no-op since :text applied no treatment. (opthelp): Provide help text for :text type. * txr.1: Documented :text getopts option type. --- share/txr/stdlib/getopts.tl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/txr/stdlib/getopts.tl b/share/txr/stdlib/getopts.tl index 3454b73f..21d892c7 100644 --- a/share/txr/stdlib/getopts.tl +++ b/share/txr/stdlib/getopts.tl @@ -32,7 +32,7 @@ helptext arg-p (type :bool) - (:static valid-types '(:bool :dec :hex :oct :cint :float :str)) + (:static valid-types '(:bool :dec :hex :oct :cint :float :str :text)) (:postinit (me) me.(check) (set me.arg-p (neq me.type :bool)))) @@ -125,6 +125,7 @@ (or (ignerr (read `"@{me.arg}"`)) (sys:opt-err "option ~a needs string lit syntax, ~a given" name me.arg)))) + (:text) (t (cond ((and (consp type) (eq (car type) 'list)) (let* ((rec-type (cadr type)) @@ -332,6 +333,7 @@ \ 3., .5, .12e9, 53.e-3, 3e-015") (:str " STR - String with embedded escapes, valid\ \ as TXR Lisp string literals\n\ - \ syntax: foo, foo\\tbar, abc\\nxyz")))) + \ syntax: foo, foo\\tbar, abc\\nxyz") + (:text " TEXT - Unprocessed text")))) (put-line ln))) (put-line)))) -- cgit v1.2.3