Open martinklepsch opened 7 years ago
As pointed out in Slack the culprit seems to be the (remove A-Z? ...)
line in boot.cli.
Not sure what the loop
in that function does I just did some basic testing with a modified impl of parse-fn
, which seemed to be just fine. Maybe @micha remembers what the loop
was all about? :)
;; build.boot
(alter-var-root
#'boot.cli/parse-fn
(fn [old-fn]
(fn parse-fn [optarg]
(fn [arg]
;; (prn :optarg optarg)
;; (prn :arg arg)
(let [valid (or (nil? optarg)
(->> optarg str (re-find #"^[\d\w_]+$")))]
;; (prn :valid valid)
(if valid
arg
(throw (ex-info "Invalid arg/optarg" {:arg arg :optarg optarg}))))))))
(deftask repro
;; try numbers or underscores here and things will fail unless you have the
;; alter-var-root block above
[a aaa MYTEST edn "edn"
b bbb bool "boolean"
c ccc ASTR str "string"
d ddd STRS [str] "multiple strings"
]
(with-pass-thru _
(println "\nvalue of aaa:" (type aaa) (pr-str aaa))
(println "\nvalue of bbb:" (type bbb) (pr-str bbb))
(println "\nvalue of ccc:" (type ccc) (pr-str ccc))
(println "\nvalue of ddd:" (type ddd) (pr-str ddd))))
$ boot repro --aaa abc --bbb --ccc 123 --ddd 123 --ddd dfg
EDIT: @micha said he doesn't remember what the loop was for so could be it's "dead".
Via Slack: