Open timgilbert opened 2 years ago
Edit: this behavior also holds true for :ednfile options; I didn't test :yamlfile but I imagine it's the same there.
:ednfile
:yamlfile
version
0.4.3
platform
JVM 11
problem
:default values for :jsonfile options do not parse files
:default
:jsonfile
repro
(require '[cli-matic.core :as c]) ;; => nil ;; Using a :jsonfile option the normal way ;; test.json consists of {"abc": 1} (c/run-cmd* {:command "foo" :opts [{:option "file" :type :jsonfile :default "test.json"}] :runs (fn [args] (clojure.pprint/pprint args))} ["--file" "test.json"]) ;; Results: {:file {"abc" 1}, :_arguments []} ;; Trying to use a default value to specify the filename if the user didn't specify (c/run-cmd* {:command "foo" :opts [{:option "file" :type :jsonfile :default "test.json"}] :runs (fn [args] (clojure.pprint/pprint args))} []) ;; Results: {:file "test.json", :_arguments []}
expected behavior
clj-matic should parse test.json and return the parsed results
actual behavior
clj-matic just gives me the default filename
Edit: this behavior also holds true for
:ednfile
options; I didn't test:yamlfile
but I imagine it's the same there.version
0.4.3
platform
JVM 11
problem
:default
values for:jsonfile
options do not parse filesrepro
expected behavior
clj-matic should parse test.json and return the parsed results
actual behavior
clj-matic just gives me the default filename