From 268b3a536b21707634646b7780fdeb19595d81fb Mon Sep 17 00:00:00 2001 From: Vincent Pelletier Date: Thu, 13 Dec 2018 15:50:48 +0900 Subject: [PATCH] shell: Add --version support. --- .gitattributes | 1 + shell/caucase.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index a647bcb..4da9e41 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ caucase/_version.py export-subst +shell/caucase.sh export-subst diff --git a/shell/caucase.sh b/shell/caucase.sh index 76eb363..3e46bcf 100755 --- a/shell/caucase.sh +++ b/shell/caucase.sh @@ -749,7 +749,7 @@ EOF status arg argc \ ca_netloc ca_address ca_port ca_path \ csr_id csr csr_path crl crt crt_path crt_dir key_path key serial \ - csr_list_json + csr_list_json version while test $# -gt 0; do arg="$1" @@ -760,6 +760,19 @@ EOF _usage return ;; + --version) + # shellcheck disable=SC2016 + version='$Format:%H$' + if [ "x$(echo "$version" | base64)" = 'xJEZvcm1hdDolSCQK' ]; then + if command -v git > /dev/null; then + version="$(git describe --tags --dirty --always --long)" + else + version='unknown' + fi + fi + printf '%s\n' "$version" + return + ;; --ca-url) _needArg 1 || return 1 ca_anon_url="$1" -- 2.25.1