jdx / usage

A specification for CLIs
https://usage.jdx.dev
MIT License
140 stars 6 forks source link

Error about unexpected argument while generating completions #142

Open aaronsky opened 2 days ago

aaronsky commented 2 days ago

Hi – wanted to make sure I'm not missing anything here. I've been following the project for a little while now and am excited for the 1.0 release. I wrote up a kdl spec and tried to run usage on it in the same way as is documented on the website, and I got this error:

❯ usage g completion fish -f ./bazel.usage.kdl
error: unexpected argument '-f' found

  tip: to pass '-f' as a value, use '-- -f'

Usage: usage generate completion [OPTIONS] <SHELL> <BIN>

For more information, try '--help'.

version info:

❯ usage --version
usage-cli 1.0.0

Is this expected? I looked at the code and couldn't find this flag on this command, and considering this very similar invocation is in mise's codebase, I figure I am doing something silly.

jdx commented 15 hours ago

ah you need to give it a bin name, so usage g completion fish bazel -f ./bazel.usage.kdl. I think it is optional if the bin name is defined in the config though.

aaronsky commented 14 hours ago

Thanks. I tried this on 1.0 but it still didn't work.

❯ usage g completion fish bazel -f ./bazel.usage.kdl
error: unexpected argument '-f' found

  tip: to pass '-f' as a value, use '-- -f'

Usage: usage generate completion [OPTIONS] <SHELL> <BIN>

For more information, try '--help'.