From 2a14ea0dce38b0da13cb24f5d08c01dfd7ef5009 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzmenkov Date: Mon, 2 Nov 2015 15:46:16 +0700 Subject: [PATCH] Add version argument to display current Sentinel version --- sentinel | 3 ++- src/args.bash | 5 ++++- src/env.bash | 1 + src/help.bash | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sentinel b/sentinel index c2222ce..be2d9f1 100755 --- a/sentinel +++ b/sentinel @@ -4,7 +4,8 @@ load_component "args" "helper" "sentinel" parse_args "$@" # Show help? -test -n "$HELP" && source ./src/help.bash && exit 1 +test -n "$ARG_HELP" && source ./src/help.bash && exit 0 +test -n "$ARG_VERSION" && echo 'Sentinel version: '$VERSION && exit 0 # Status commands test -n "$ARG_STATUS" && load_component "status" && display_task_status "$ARG_STATUS" && exit 0 diff --git a/src/args.bash b/src/args.bash index 89b6572..0d3a9a9 100644 --- a/src/args.bash +++ b/src/args.bash @@ -54,8 +54,11 @@ parse_args() { --task-example) export TASK_EXAMPLE=1 ;; + --version|-v) + export ARG_VERSION=1 + ;; --help|-h) - export HELP=1 + export ARG_HELP=1 ;; *) # unknown option ;; diff --git a/src/env.bash b/src/env.bash index 39f8759..9808197 100644 --- a/src/env.bash +++ b/src/env.bash @@ -1,4 +1,5 @@ #!/bin/bash +export VERSION='0.1.0-pre' export CHECK_TIMEOUT=3 export TASKS_DIR='./tasks' export WORK_DIR='./proc' diff --git a/src/help.bash b/src/help.bash index e6663b8..77e26d5 100644 --- a/src/help.bash +++ b/src/help.bash @@ -35,6 +35,6 @@ Gathering info about running processes: --status=# Get status for # task name Other: - + --version -v Display current Sentinel's version --help -h Display this help EOF