-
Notifications
You must be signed in to change notification settings - Fork 123
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
Flags showing up before subcommands #17
Comments
At the very least, it should warn the user about it being ignored. In the best case, it should follow the usual UNIX tool: flags can be used in any order. |
I'm going to go with (A) because with |
Im using cli too and the way I use is the $ foo --no-color subcommand -bar -quz 0 Here Having said that, as seen it complicates things a little bit, so I agree with @mitchellh here, however it's also nice to be able to use global flags, such as |
@fatih Yeah we have some global args for some of our projects as well. We preprocess the |
Done! |
@mitchellh It seems git allows flags before subcommand.
Any flag before |
@fatih Git allows only global flags. It doesn't allow subcommand flags before it. I think extending the global flags might be useful, but there are easy workarounds (pre-processing the arg slice for example). |
@mitchellh yeah, I'm saying that So for example, say for usage: packer [--template-path] [--version] [--help] <command> [<args>]
Available commands are:
build build image(s) from template
fix fixes templates from old versions of packer
inspect see components of a template
push push template files to a Packer build service
validate check that a template is valid
version Prints the Packer version Note the
|
Filing this for hashicorp/terraform#1773
Current behavior: Except for help/version, flags before a subcommand are silently ignored.
Possible solutions:
(A) Flags before subcommand cause error
(B) Flags before subcommand are passed in as subcommand args
Unsure what the better behavior. Originally I thought (A) but then I swung to (B) after staring at it a bit.
Thoughts?
The text was updated successfully, but these errors were encountered: