Actions
Task #1575
closedadd `--version` option to nfd and nrd commands
Start date:
05/02/2014
Due date:
% Done:
100%
Estimated time:
3.00 h
Description
Other command-line tools should probably also support --version.
Actions
Added by Alex Afanasyev over 11 years ago. Updated over 11 years ago.
100%
Description
Other command-line tools should probably also support --version.
Should the version printed include tokens like "rc", "beta"?
Should the version printed include git commit hash? (available only if compiled from git repository)
This feature is unnecessary. User can always observe NFD version with nfd-status.
it shouldn't rely on another program to get the version number. what if nfd cannot successfully run? getting the version number would help debugging, but nfdc won't work.
I agree with Beichuan. Getting version from running NFD is one thing, getting version of the tool / nfd binary is another.
As for the other question. I feel that we should include additional information (e.g., for rc-1, it should mention rc-1). For git source-compiled non-release version it also a good idea to include some part of hash (or just git commit in parentheses). However, we should not include this information when somebody uses source code from git, but compiles the released version...
A common way to do that is using the output of git describe --always, possibly with --tags and/or --dirty too, when building from a git checkout.
Information from core/version.hpp should always be printed.
git describe --always is fine.
The solution should not break when code is not in a git repository (eg. downloaded ZIP from GitHub).