Skip to content

Commit

Permalink
yeah
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Jan 2, 2024
1 parent ebf31aa commit a52735f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/babashka/cli.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,8 @@
{:cmd-info cmd-info
:dispatch cmds
:opts (dissoc all-opts ::opts-by-cmds)
:opts-by-cmds (::opts-by-cmds all-opts)
;; NOTE: won't expose this just yet, wait for more feedback, structure may not be optimal
;; :opts-by-cmds (::opts-by-cmds all-opts)
:args args}
(if arg
{:error :no-match
Expand All @@ -636,7 +637,8 @@
(fn [{:keys [msg] :as data}]
(throw (ex-info msg data))))
error-fn (fn [data]
(-> {:tree tree :type :org.babashka/cli
(-> {;; :tree tree
:type :org.babashka/cli
:wrong-input wrong-input :all-commands available-commands}
(merge data)
error-fn*))]
Expand Down
5 changes: 2 additions & 3 deletions test/babashka/cli_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@
{:cmds ["foo" "bar" "baz"]
:spec {:quux {:coerce :keyword}}
:fn identity}])
(is (submap? {#_#_:tree tree
:type :org.babashka/cli
(is (submap? {:type :org.babashka/cli
:cause :input-exhausted
:all-commands ["foo"]}
(try (cli/dispatch table [])
Expand Down Expand Up @@ -351,7 +350,7 @@
(is (submap?
{:dispatch ["foo" "bar"],
:opts {:foo :dude3},
:opts-by-cmds
#_#_:opts-by-cmds
[{:cmds [], :opts {:foo :dude1}}
{:cmds ["foo"], :opts {:foo :dude2}}
{:cmds ["foo" "bar"], :opts {:foo :dude3}}],
Expand Down

0 comments on commit a52735f

Please sign in to comment.