4 ms·
I agree that `--version` should always be present, but I think `-v` as an alias for version is not uncommon. In fact, I usually try it before I bother with `--v
by chrisfosterelli 10y ago
I agree that `--version` should always be present, but I think `-v` as an alias for version is not uncommon. In fact, I usually try it before I bother with `--version`.
Trying the first few programs off the top of my head I found node, ruby, docker, clang, npm, and even the man command all respond to the `-v` flag. I think that's common enough for me to support it when I don't need a verbosity toggle.
- lucb1e 10y agoHmm. I suppose if there is no default action (given no stdin input is provided) then -v might still mean verbose and print a version. Like, running grep by itself does nothing, but grep -v by itself might print a version because it's more info (more verbose) than nothing. Commands that do something without arguments, like cat (even though it just blocks, waiting for input) might still print the version to stderr I suppose. That would be a way to solve both cases.
- restalis 10y ago"I agree that `--version` should always be present" I'm not sure why version information has to have an option on its own. For humans it can be provided in help. Considering the limited usefulness it has as a separate thing, it's just command option garbage.