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

--format flag order matters #485

Open
marcospb19 opened this issue Aug 16, 2023 · 1 comment
Open

--format flag order matters #485

marcospb19 opened this issue Aug 16, 2023 · 1 comment
Labels
bug Something isn't working waiting ecosystem Waiting for other crates in ecosystem

Comments

@marcospb19
Copy link
Member

marcospb19 commented Aug 16, 2023

Version

0.4.2

Description

When compressing an archive with --format, not all positions are supported and the error message isn't helpful.

Current Behavior

ouch compress a b c output --format tar.gz # 1
ouch compress a b c --format tar.gz output # 2
ouch compress a b --format tar.gz c output # 3
ouch compress a --format tar.gz b c output # 4
ouch compress --format tar.gz a b c output # 5

1 and 5 works, 2-4 doesn't.

Error message for 3:

$ ouch compress a b --format tar.gz c output
error: unexpected argument 'c' found

Usage: ouch compress [OPTIONS] <FILES>... <OUTPUT>

For more information, try '--help'.

To show that it also happens with a single file as input:

ouch compress input output --format gz # 6
ouch compress input --format gz output # 7
ouch compress --format gz input output # 8

6 and 8 works, 7 doesn't.

Error message for 7:

$ ouch compress input --format gz output
error: unexpected argument 'output' found

Usage: ouch compress [OPTIONS] <FILES>... <OUTPUT>

For more information, try '--help'.

Expected Behavior

1-8 should all work.

Additional Information

We should add more tests for CLI usage that cover these.

@marcospb19
Copy link
Member Author

marcospb19 commented Sep 8, 2023

Looks like this is a limitation of clap, issue at clap-rs/clap#5115.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting ecosystem Waiting for other crates in ecosystem
Projects
None yet
Development

No branches or pull requests

1 participant