Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException when optional flags are ommitted and additional args are passed to bb.cli.exec/main #104

Open
felixdo opened this issue Aug 23, 2024 · 1 comment

Comments

@felixdo
Copy link

felixdo commented Aug 23, 2024

parse-exec-opts throws an IllegalArgumentException in the following case:

(ns fs123.test (:require [babashka.cli :as cli] [babashka.cli.exec]))

(defn test
  {:org.babashka/cli
   {:spec
     {:flag {:coerce :boolean :default true} }
    :args->opts [:args2opts]}}
  [what] what)

(babashka.cli.exec/main "fs123.test" "test-me" "my-arg")

Originating discussion from slack.

@felixdo
Copy link
Author

felixdo commented Aug 23, 2024

parse-commands is used to resolve the target function, for which at max 2 args should be consumed, that's why the cond only handles 0,1,2. The question is, what should we do with the remaining positional arguments? If we just "forget them", wouldnt be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant