A blog about random thoughts
According to clojure.tools.cli/parse-opts
document, options are a sequence of vectors.
To use short option for non-boolean case, like git -C <repo-directory>
, we need to define options like below.
nil
as the option only has short form.:required
must be set. Otherwise, the option will be taken as boolean one. The value of this property will be showed just after the short flag, like -C <required value or long form spec> <description>
, so here using empty as placeholder.:id
should be set. The property is used to retrieve value from parsed opts
, like (:dir opts)
:default-desc
to empty string to omit it.(def ^:private cli-options
[["-C" nil "Specify repository directory (default pwd)"
:id :dir
:default pwd
:default-desc ""
:required ""]])
Published: 2023-10-02
Tagged: clojure