I'm a Clojure newbie.
I need multiple arguments for option -a
of my cli app, like:
java -jar app.jar -a 12 abc xyz
First one is a number, and other two have to be strings.
My code is:
["-a" "--add LINE TYPE ENTRY" "Add entry to specified line number of the menu"
:parse-fn #(split % #" ")
:validate [#(number? (Integer/parseInt (first %))) "ERROR: Invalid position"]
But I observed the %
passed to :parse-fn
function to be a vector containing only the first argument, i.e., [12]
the other arguments are listed as value of the key :arguments
of the map returned by parse-opts
Now,
(1) Is there a way to validate those unprocessed arguments?
(2) How will I retrieve and use those arguments?