Closed lread closed 4 years ago
version 0.3.11
platform java 8 on macOS
problem positional argument usage help is not formatted correctly
repro If I taketoycalc.clj and modify it to toycalc-positional.clj:
toycalc.clj
toycalc-positional.clj
#!/bin/sh #_( #_This runs clj so we use the deps.edn but specify which module #_we want to run. exec clj -J-Xms256m -J-Xmx256m -J-client -J-Dclojure.spec.skip-macros=true -i "$0" -m toycalc "$@" ) (ns toycalc (:require [cli-matic.core :refer [run-cmd]])) ;; To run this, try from the project root: ;; clj -i examples/toycalc.clj -m toycalc add -a 1 -b 80 (defn add_numbers "Sums A and B together, and prints it in base `base`" [{:keys [a1 a2 base]}] (println (Integer/toString (+ a1 a2) base))) (defn subtract_numbers "Subtracts B from A, and prints it in base `base` " [{:keys [pa pb base]}] (println (Integer/toString (- pa pb) base))) (def CONFIGURATION {:app {:command "toycalc" :description "A command-line toy calculator" :version "0.0.1"} :global-opts [{:option "base" :as "The number base for output" :type :int :default 10}] :commands [{:command "add" :short "a" :description ["Adds two numbers together" "" "Looks great, doesn't it?"] :opts [{:option "a1" :short 0 :env "AA" :as "First addendum" :type :int :default 0} {:option "a2" :short 1 :as "Second addendum" :type :int :default 0}] :runs add_numbers} {:command "sub" :short "s" :description "Subtracts parameter B from A" :opts [{:option "pa" :short 0 :as "Parameter A" :type :int :default 0} {:option "pb" :short 1 :as "Parameter B" :type :int :default 0}] :runs subtract_numbers}]}) (defn -main "This is our entry point. Just pass parameters and configuration. Commands (functions) will be invoked as appropriate." [& args] (run-cmd args CONFIGURATION))
And run ./toycalc-positional.clj add --help
./toycalc-positional.clj add --help
expected behavior USAGE should read:
USAGE: toycalc [add|a] [command options] a1 a2
actual behavior USAGE reads:
USAGE: toycalc [add|a] [command options] a1a2 ...
proposal The positional parameters need a space between them and don't need the trailing ...
...
action I will follow up with a PR.
version 0.3.11
platform java 8 on macOS
problem positional argument usage help is not formatted correctly
repro If I take
toycalc.clj
and modify it totoycalc-positional.clj
:And run
./toycalc-positional.clj add --help
expected behavior USAGE should read:
actual behavior USAGE reads:
proposal The positional parameters need a space between them and don't need the trailing
...
action I will follow up with a PR.