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

error: invalid value './index.html' for '--release [<RELEASE>]' #908

Open
antifuchs opened this issue Nov 8, 2024 · 2 comments
Open

error: invalid value './index.html' for '--release [<RELEASE>]' #908

antifuchs opened this issue Nov 8, 2024 · 2 comments

Comments

@antifuchs
Copy link

antifuchs commented Nov 8, 2024

Recent versions of trunk (definitely 0.21.1 but I've reproduced in 0.21.4) have started requiring the --release CLI parameter with a boolean argument (as --release=true). I suspect that's not intended: The commit message at 265599c#diff-46230eb6eb9a3792464a39b022f624c28ce91fed38482b30f47f483f7ef14967R24 states non-value variants are meant to be acceptable.

Reproducable with:

:;    trunk build --release ./index.html
error: invalid value './index.html' for '--release [<RELEASE>]'
  [possible values: true, false]

For more information, try '--help'.

Since the cmd.rs code didn't change, is a downstream dependency misbehaving?

@airblast-dev
Copy link
Contributor

airblast-dev commented Nov 8, 2024

clap likely can't know if the index.html argument is for the --release flag or not since there is also an optional positional argument present.

For example trunk build --release ./index.html:
Is this a faulty argument for release, or are they seperate arguments (--release and ./index.html)?

The error itself is somewhat confusing though.

I am not sure this can be changed on trunk's end (though its been a while since I checked the CLI code) but as a practical solution you instead run trunk build ./index.html --release, and it will build it in the release profile. Simply putting the target argument before the flags should work since now there isn't ambiguity.

Edit: Tested with trunk 0.19.3, and trunk build --release ./index.html works fine so its definitely a regression.

@antifuchs
Copy link
Author

That's a good point - putting --release at the end of the parameter list works for both 0.20 and 0.21.

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

2 participants