Closed ieugen closed 4 years ago
Looking at the oclif features, I think having an examples field in configuration to display during help is very useful in practice.
examples
See :examples
:examples
(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 "a" :env "AA" :as "First addendum" :type :int :default 0} {:option "a2" :short "b" :as "Second addendum" :type :int :default 0}] :runs add_numbers} {:command "sub" :short "s" :description "Subtracts parameter B from A" :opts [{:option "pa" :short "a" :as "Parameter A" :type :int :default 0} {:option "pb" :short "b" :as "Parameter B" :type :int :default 0}] :examples '("toycalc -m calc add --a2 3 5" "toycalc -m calc add --a2 19 5"") :runs subtract_numbers}]})
https://github.com/oclif/example-multi-ts/blob/master/src/commands/hello.ts
I like this, I always add an example in the docs. I'm sure there are a number of interesting things in oclif
Done!
Looking at the oclif features, I think having an
examples
field in configuration to display during help is very useful in practice.See
:examples
https://github.com/oclif/example-multi-ts/blob/master/src/commands/hello.ts