diff options
author | Teddy Wing | 2019-06-10 19:50:10 +0200 |
---|---|---|
committer | Teddy Wing | 2019-06-10 19:50:10 +0200 |
commit | 62ea9eb82d4aa9edf3cbe27a3cced88bf989bbcf (patch) | |
tree | 4e0dfe4c4d8d6c4d040a9c0053f5618896d2d745 | |
parent | e776421211a713d182600076ce0ab6b508f9275c (diff) | |
download | code-review-62ea9eb82d4aa9edf3cbe27a3cced88bf989bbcf.tar.bz2 |
code-review: Add a version number and `--version` program flag
-rwxr-xr-x | code-review | 9 | ||||
-rw-r--r-- | doc/code-review.1 | 5 | ||||
-rw-r--r-- | doc/code-review.1.txt | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/code-review b/code-review index a97df7a..d6ddab7 100755 --- a/code-review +++ b/code-review @@ -19,10 +19,12 @@ EX_USAGE=64 +VERSION=0.0.1 + function print_usage () { cat <<-EOF - usage: code-review [--help] <command> [<args>] + usage: code-review [--help] [--version] <command> [<args>] Commands: @@ -50,6 +52,11 @@ if [ -z "$subcommand" ] || [ "$1" = '--help' ] || [ "$1" = '-h' ]; then exit "$EX_USAGE" fi +if [ "$1" = '--version' ]; then + echo "$VERSION" + exit 0 +fi + if ! program_exists "${program}-${subcommand}"; then echo >&2 "${program}: '${subcommand}' is not a ${program} command. See '${program} --help'" exit "$EX_USAGE" diff --git a/doc/code-review.1 b/doc/code-review.1 index e671bff..06b013b 100644 --- a/doc/code-review.1 +++ b/doc/code-review.1 @@ -41,6 +41,11 @@ A collection of tools that facilitate code review on the command line\&. .RS 4 Print usage help\&. .RE +.PP +\-\-version +.RS 4 +Print the program version\&. +.RE .SH "COMMANDS" .PP changed\-files diff --git a/doc/code-review.1.txt b/doc/code-review.1.txt index 276399f..df2a087 100644 --- a/doc/code-review.1.txt +++ b/doc/code-review.1.txt @@ -18,6 +18,9 @@ OPTIONS -h, --help:: Print usage help. +--version:: + Print the program version. + COMMANDS -------- changed-files:: |