-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Unknown option when alias begins with other alias #82
Comments
Can you please post a full repro, not just some fragments? I'm not sure how to reproduce your problem. What arguments are you parsing for example. |
I assume that this is your full repro: (require '[babashka.cli :as cli] :reload)
(prn
(cli/parse-opts
["-vv"]
{:spec {:verbose {:desc "Enable verbose output.", :alias :v}
:very-verbosd {:desc "Enable very verbose output.", :alias :vv}}
:closed true})) |
One way to allow multiple aliases to be used is this: (prn
(cli/parse-opts
["-vv"]
{:spec {:verbose {:coerce []
:desc "Enable verbose output.", :alias :v}}
:closed true})) which results into this: {:verbose [true true]} |
I do consider the above as a bug which I'll fix though |
Just woke up on this side of the world with awesome news thank you! Next time I'll make a repro sorry about that. |
Also released a new bb version. Perhaps it would be good to document that above usage of |
I can do that |
Thanks very much! |
@borkdude while checking the docs I noticed this
(cli/parse-opts ["-abc"])
;;=> {:a true :b true :c true} And I was wondering if the following is also a (smaller) bug: (prn (cli/parse-opts ["-vvv"]))
{:v true} I can change the docs to say that only "single letter" flags behave that way. Thoughts? |
Yes, only single letter flags behave that way, it's UNIX convention I believe. But if you add |
Here is a bit of docs around the use cases described in babashka#82.
Here is a bit of docs around the use cases described in #82.
Hi there!
I have the following
:spec
:That when I
cli/parse-args
returns the unknown option error (via the:error-fn
):I could reproduce it only when
:vv
is used as:alias
.Using
bb --version babashka v1.3.186
.The text was updated successfully, but these errors were encountered: