File tree Expand file tree Collapse file tree
src/net/lewisship/cli_tools
test/net/lewisship/cli_tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change 906906 invoke-last-command-fn nil ]
907907 (cond-let
908908 (#{" -h" " --help" } term)
909- (if invoke-last-command-fn
910- (invoke-last-command-fn )
911- (do
912- (print-commands nil container-map commands-map false )
913- (exit 0 )))
909+ (do
910+ (print-commands nil container-map commands-map false )
911+ ; ; This is the ugly mixed case where its a group and a command; we present
912+ ; ; the group first then the command.
913+ (when invoke-last-command-fn
914+ (println )
915+ (invoke-last-command-fn ))
916+ (exit 0 ))
914917
915918 :let [possible-commands commands-map
916919 matchable-terms (keys possible-commands)]
Original file line number Diff line number Diff line change 3939 (dispatch " mess" " kiwi" ))))
4040
4141(deftest help-for-messy-command-shows-command-help
42- (let [{:keys [status out]} (dispatch " mess" " -h" )]
43- (is (= 0 status))
44- (is (string/includes? out " Usage:" ))
45- (is (string/includes? out " NAME" ))
46- (is (not (string/includes? out " nested" )))))
42+ (is (match? {:status 0
43+ :out-lines [" bigmess messy - Messy command and group at same time"
44+ " "
45+ " Commands:"
46+ " nested: Command nested under messy group/command"
47+ " "
48+ " Usage: bigmess messy [OPTIONS] NAME"
49+ " Messy command."
50+ " "
51+ " Options:"
52+ " -h, --help This command summary"
53+ " "
54+ " Arguments:"
55+ " NAME: Name to print" ]}
56+ (dispatch " mess" " -h" ))))
4757
4858(comment
4959
You can’t perform that action at this time.
0 commit comments