-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Treat all flags which followd behind the last arguments as normal arg… #515
Conversation
LGTM |
The usual "unix-y" way to handle this (which this library supports thanks to stdlib I can see the argument you are making for |
yes, add -- is ok, but use "runc exec -- test ls -la" instead "runc exec test ls -la", some people think it might be a bug.
it will skip -la, but it also skip --cwd. |
…uments Signed-off-by: Shukui Yang <yangshukui@huawei.com>
@keloyang gotcha, so the subcommand also has flags. The behavior you describe is actually the default behavior of the underlying I can imagine a future where Let me know what you think about this and I can backport it. Thanks for bringing this up! (and apologies for stepping on your toes @gravis 😄 -- this issue just reminded me of the work I'd done in #398 around removing reordering). |
@gravis you've still got this? 😸 |
I was planning on working on the backport of #398 today, but let me know if anyone is actively working on this! |
In the unreleased version 2, the argument reordering has been removed (in f585ec7) since it only worked if all of the arguments appeared before all of the flags, but not if they were intermixed which was of limited utility and caused some confusion. This commit allows enabling of this future behavior via SkipArgReorder. Ideally we'd support complete intermingling of flags and arguments, but this is unlikely to happen until we switch flag parsers. Fixes #515
If SkipFlagParsing is not considered,cli treat all words which start by '-' as flag, so when the subcommand has a argument which start by '-', it also will treated as cli' flag, not a argument for subcommand.
e.g.
I think cli should treat all flags which followd behind the last arguments as normal arguments,just like this:
opencontainers/runc#752 for details.
Signed-off-by: Shukui Yang yangshukui@huawei.com