From 55cfcb8e03eefb58ac0d98a1f69b6842c2a11b22 Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Sun, 27 Jan 2019 20:16:39 +0800 Subject: [PATCH] Add version info Also remove redundant DATEH_DEFAULT_FORMAT setting --- README.md | 1 + dateh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f6bb9f..c741fc3 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Copy `dateh` to a directory in your `PATH`. `dateh` takes the same options and format specifiers as GNU `date`, in addition to: * `-h|--help` to print `dateh`-specific help * `-H|--longhelp` to print both `dateh` and `date` help +* `-V|--version` to print `dateh` version If the `DATEH_DEFAULT_FORMAT` environment variable is set, `dateh` uses its value as the fallback date representation for the `@{d+}` specifier (default: `%Y-%m-%d`). diff --git a/dateh b/dateh index 074a130..7e0896c 100755 --- a/dateh +++ b/dateh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -DATEH_DEFAULT_FORMAT="${DATEH_DEFAULT_FORMAT:-%Y-%m-%d}" +VERSION=1.0 short_ordinals=(invalid 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th 26th 27th 28th 29th 30th 31st) @@ -142,6 +142,7 @@ while true; do case "$1" in -h|--help) usage;; -H|--longhelp) usage long;; + -V|--version) echo "dateh ${VERSION}"; exit 0;; *) break;; esac shift