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

'consul lock' should recognize '--' to stop processing command line switches #776

Closed
babbottscott opened this issue Mar 11, 2015 · 5 comments
Labels
theme/cli Flags and documentation for the CLI interface type/enhancement Proposed improvement or new feature

Comments

@babbottscott
Copy link

Under 'consul lock', on calling a child process that takes '-v' as an argument, we get the following:

$ consul lock --help
Usage: consul lock [options] prefix child...
...
$ consul lock -n 1 lock_it cat -v foo
Consul v0.5.0
Consul Protocol: 2 (Understands back to: 1)
$

We can enclose the child command line with quotes, but this adds a required layer of quoting to a bash command line (never a desirable thing if it can be avoided).

Desired solution: use '--' switch to end switch processing. Anything that follows would be presumed to be part of "child"

$ consul lock -n 1 lock_it -- cat -v foo
cat: foo: No such file or directory

Alternatively: don't necessarily need a -- switch. Just have first non-option argument be "prefix", and all following arguments be "child", as the --help message suggests.

@mfischer-zd
Copy link
Contributor

+1, this will make it consistent with other programs' behavior WRT argument passing

@ryanuber
Copy link
Member

Thanks for the report! This was a relatively simple fix, since Go's flag already supports the -- splitter. The problem was just the -v or --version flags, which should be fixed after 45f5997.

@babbottscott
Copy link
Author

many thanks!

@babbottscott
Copy link
Author

I am still seeing this behavior on 0.5.2

@armon armon reopened this Jul 22, 2015
@slackpad slackpad added the type/enhancement Proposed improvement or new feature label May 2, 2017
@slackpad slackpad added the theme/cli Flags and documentation for the CLI interface label May 25, 2017
@hanshasselberg
Copy link
Member

Thank you for reporting! I can still reproduce the described behavior. Since there is a workaround by using quotes, I am going to close this issue, because it not such a big deal for us. If you or someone else would be willing to provide a PR, we would be happy to merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/cli Flags and documentation for the CLI interface type/enhancement Proposed improvement or new feature
Projects
None yet
Development

No branches or pull requests

6 participants