I’ve been running in to some problems running an install command:
snap install --edge --classic <snap>
and I wanted to try and get some extra output from snap in order to help me debug. I appended --help to my command to find out if there were any options like --debug or --verbose:
snap install --edge --classic <snap> --help
but this only showed me the help for snap install, which didn’t help me. Figuring that there might be some global options to the snap command, I tried moving --help to be right after snap:
snap --help install --edge --classic <snap>
--help was unexpectedly ignored entirely, and the install command ran! This, to me, is unexpected behaviour. Fortunately for me, the command running unexpectedly in this case wasn’t a problem; if I had been trying to get help on how to do something more destructive then this could have been Very Bad.
FWIW, global options would be listed in the command’s help, below the per-command options (we don’t currently have any, but I’ve toyed with the idea of making --unicode and --color global)
If I understand the fix correctly, this makes snap --help install equivalent to snap help, not snap help install. In all sensible option parsing (oh, boy do I hate go’s command line parsing) --help foo and foo --help are equivalent.