IllegalArgumentException when optional flags are ommitted and additional args are passed to bb.cli.exec/main
felixdo opened this issue · comments
felixdo commented
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 commented
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.