nerdctl-stub: Allow positional arguments mixed with flags#8320
Conversation
12c7693 to
7fea042
Compare
|
It looks like this is more complicated than I expected: C:\Users\SUSE\build>nerdctl run busybox sh -c "echo Hello world"
2025/03/05 15:51:32 Error parsing arguments: command "container run" does not support option -cThe command runs, but the incorrect error message is not really acceptable. Maybe there is a rule where you can't have additional But if you have only mandatory positional arguments, then they can be followed by more flags: I haven't checked if that rule would hold everywhere, and it seems kind of too magical anyways. Unfortunately argument handling in |
|
I think we need to look for Note the annoying Just looking for |
Sometimes it would be convienent for the user to mix positional arguments with flags, e.g. `nerdctl build --tag foo . --file Containerfile.custom`. Support this case by parsing all flags, then dumping all positional arguments later. This can only work if no command contains both positional arguments as well as subcommands (so that we can reliably detect them); add a case in the help output parser to check this. This also adds a `yarn generate:nerdctl-stub --verbose` that gets passed to the generator so it is easier to see what it is doing. Signed-off-by: Mark Yen <mark.yen@suse.com>
This fixes `nerdctl run ... -flag` to not warn on flags that are not to be parsed by nerdctl. Signed-off-by: Mark Yen <mark.yen@suse.com>
ece9a9e to
420f92d
Compare
|
I've rebased this PR on latest |
Signed-off-by: Jan Dubois <jan.dubois@suse.com>
Sometimes it would be convenient for the user to mix positional arguments with flags, e.g.
nerdctl build --tag foo . --file Containerfile.custom. Support this case by parsing all flags, then dumping all positional arguments later. This can only work if no command contains both positional arguments as well as subcommands (so that we can reliably detect them); add a case in the help output parser to check this.This also adds a
yarn generate:nerdctl-stub --verbosethat gets passed to the generator so it is easier to see what it is doing.Fixes #8190