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

- Fix #91: keyword options and hyphen options should not mix

## v0.8.58 (2024-03-12)

Fix [#89](https://github.com/babashka/cli/issues/89): long option never represents alias
Expand Down
3 changes: 2 additions & 1 deletion src/babashka/cli.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@
(defn- parse-key [arg mode current-opt coerce-opt added]
(let [fst-char (first-char arg)
snd-char (second-char arg)
hyphen-opt? (and (= fst-char \-)
hyphen-opt? (and (not= :keywords mode)
(= fst-char \-)
(not (number-char? snd-char)))
mode (or mode (when hyphen-opt? :hyphens))
fst-colon? (= \: fst-char)
Expand Down
4 changes: 4 additions & 0 deletions test/babashka/cli_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -548,3 +548,7 @@

(deftest issue-89-alias-only-for-short-opt
(is (= {:f "dude"} (cli/parse-opts ["--f" "dude"] {:spec {:foo {:alias :f}}}))))

(deftest issue-91-keyword-mode-overrides-hypens-mode
(is (= {:args ["--baz"], :opts {:foo 1}}
(cli/parse-args [":foo" 1 "--baz"] {}))))