Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ For breaking changes, check [here](#breaking-changes).

[Babashka CLI](https://github.com/babashka/cli): turn Clojure functions into CLIs!

## Unreleased

- Help: separate command names and docs with two spaces, like the `Options:` and `Arguments:` sections

## 0.12.84

- zsh completion: offer a command's options without typing a dash first, by opting the registered program names out of zsh's `prefix-needed` style
Expand Down
4 changes: 2 additions & 2 deletions src/babashka/cli.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@
(conj desc)

(seq cmds)
(conj (str "Commands:\n" (format-table {:rows cmds :indent 2})))
(conj (str "Commands:\n" (format-table {:rows cmds :indent 2 :divider " "})))

(seq arg-rows)
(conj (str "Arguments:\n" (format-table {:rows arg-rows :indent 2 :divider " "})))
Expand Down Expand Up @@ -2010,7 +2010,7 @@ $env.config.completions.external.completer = {|spans|
(str/join "\n"
(concat [message ""]
(when (seq cmds)
[(str "Commands:\n" (format-table {:rows cmds :indent 2})) ""])
[(str "Commands:\n" (format-table {:rows cmds :indent 2 :divider " "})) ""])
[hint]))))]
(cond
(or (= :no-match cause) (= :input-exhausted cause))
Expand Down
6 changes: 3 additions & 3 deletions test/babashka/cli_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@
:spec {:recursive {:alias :r :desc "Delete recursively"}}}]]
(testing "top level: usage, commands, options, pointer"
(is (= (str "Usage: example [options] <command>\n\n"
"Commands:\n copy Copy a file\n delete Delete a file\n\n"
"Commands:\n copy Copy a file\n delete Delete a file\n\n"
"Options:\n -v, --verbose Verbose output\n\n"
"Run \"example <command> --help\" for more information on a command.")
(cli/format-command-help {:table table :prog "example"}))))
Expand Down Expand Up @@ -1176,7 +1176,7 @@
:epilog ["Examples:" " p go"]}]]
(is (= (str "Usage: p <command>\n\n"
"Tool.\n\nSecond paragraph.\n\n"
"Commands:\n go Runs it.\n\n"
"Commands:\n go Runs it.\n\n"
"Run \"p <command> --help\" for more information on a command.")
(cli/format-command-help {:table t :prog "p"})))
(is (= (str "Usage: p go\n\n"
Expand Down Expand Up @@ -1214,7 +1214,7 @@
:dispatch [] :prog "tool"
:tree (cli/table->tree table)})]
(is (= (str "Unknown command: nope\n\n"
"Commands:\n dev Start dev.\n deps Dep tools\n\n"
"Commands:\n dev Start dev.\n deps Dep tools\n\n"
"Run \"tool --help\" for more information.")
s))))
(testing ":input-exhausted (incomplete multi-word command) renders the group's commands"
Expand Down
Loading