diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-11-29 06:26:37 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-11-29 06:26:37 -0800 |
commit | efd63397acfae905ee2d8031fd84d3a821a04fce (patch) | |
tree | 42e107c1506c4af47e5324f514ddcd3deae9688f | |
parent | ba94da1da968be68815249b3de2da0d67d7c966e (diff) | |
download | txr-efd63397acfae905ee2d8031fd84d3a821a04fce.tar.gz txr-efd63397acfae905ee2d8031fd84d3a821a04fce.tar.bz2 txr-efd63397acfae905ee2d8031fd84d3a821a04fce.zip |
getopts: rename add method to add-opt.
The reason for this rename is that add is a public symbol in
the usr package, thanks to the build macro. This will
interfere with an upcoming feature under which options appear
directly as struct slots, defined by symbols. If a user
defines an --add option using the symbol add, it will clash
with the add method. But add-opt will be sys:add-opt.
* share/txr/stdlib/getopts.tl (opts add): Rename to add-opt.
(sys:opt-processor parse-long, sys:opt-processor
parse-shorts): Follow rename.
-rw-r--r-- | share/txr/stdlib/getopts.tl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/share/txr/stdlib/getopts.tl b/share/txr/stdlib/getopts.tl index f155b238..d0aaca12 100644 --- a/share/txr/stdlib/getopts.tl +++ b/share/txr/stdlib/getopts.tl @@ -149,7 +149,7 @@ (set o.arg val) (error "opts: cannot set option ~s to ~s: no such option" key val))) -(defmeth opts add (me opt) +(defmeth opts add-opt (me opt) (whenlet ((n opt.desc.short)) (set [me.opt-hash n] opt)) (whenlet ((n opt.desc.long)) @@ -175,14 +175,14 @@ ((null od) (sys:opt-err "unrecognized option: --~a" opt)) ((and arg od.arg-p) - opts.(add (new (sys:opt-parsed opt arg od)))) + opts.(add-opt (new (sys:opt-parsed opt arg od)))) ((stringp arg) (sys:opt-err "option --~a doesn't take an argument" opt)) (od.arg-p (iflet ((arg (pop opts.out-args))) - opts.(add (new (sys:opt-parsed opt arg od))) + opts.(add-opt (new (sys:opt-parsed opt arg od))) (sys:opt-err "option --~a requires an argument" opt))) - (t opts.(add (new (sys:opt-parsed opt arg od)))))))) + (t opts.(add-opt (new (sys:opt-parsed opt arg od)))))))) (defmeth sys:opt-processor parse-shorts (me opts) (each ((o (split-str opts #//))) @@ -195,7 +195,7 @@ (unless opts.out-args (sys:opt-err "option -~a requires an argument" o)) (pop opts.out-args)))) - opts.(add (new (sys:opt-parsed o arg od)))) + opts.(add-opt (new (sys:opt-parsed o arg od)))) (sys:opt-err "unrecognized option: -~a" o)))) (defmeth sys:opt-processor parse-opts (me args) |