You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And adjust 'runc --version' to print exactly the same content.
The:
$ COMMAND --version
interface is a popular one for this information and makes a lot of
sense for single-action commands. For example, printf(1) [1] is only
ever going to do one meaningful thing, so --version, --help, and other
command-like actions work well as options.
Umbrella commands with multiple sub-commands, on the other hand, have
a more consistent interface if '... and exit' actions get their own
sub-commands. That allows you to declare an interface like:
$ COMMAND [global-options] SUB-COMMAND [sub-command-specific-options] [sub-command-specific-arguments]
without having to say "except if you use a sub-command-like global
option, in which case SUB-COMMAND is not allowed".
With this commit, we add support for 'version' while keeping
--version, because while 'version' makes more sense for umbrella
commands, a user may not know if runc is an umbrella command when they
ask for the version.
Existing umbrella commands are not particularly consistent:
* git(1) supports both --version and 'version', --help and 'help'.
* btrfs(8) supports both --version and 'version', --help and 'help'.
* ip(1) supports -V / -Version and 'help'.
* npm supports 'version' and 'help'.
* pip supports '--version', --help and 'help'.
Setting .Version to the empty string takes advantage of the {{if
.Version}} conditional [2] to avoid --help showing:
VERSION:
0.0.0
because we are no longer setting .Version. I floated a few options
[4], and Mike Brown (the only one with a preference) was in favor of
dropping the VERSION section [5] (which turned out to not need a
AppHelpTemplate adjustment ;).
The help tests ensure that attempting to remove "VERSION" from the
help output does not change the output (i.e. that the output didn't
contain "VERSION" to begin with). That protects us from subsequent
urfave/cli changes breaking the empty-string .Version approach.
[1]: http://www.man7.org/linux/man-pages/man1/printf.1.html
[2]: https://github.com/urfave/cli/blob/v1.18.1/README.md#customization-1
[3]: opencontainers#940 (comment)
[4]: opencontainers#940 (comment)
[5]: opencontainers#940 (comment)
Signed-off-by: W. Trevor King <[email protected]>
0 commit comments