From b216f35dca55c56ce5505ee61e7f6e52a2069597 Mon Sep 17 00:00:00 2001 From: Altan Orhon Date: Tue, 3 Oct 2023 16:54:11 -0700 Subject: [PATCH] Added version --- hyakvnc.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/hyakvnc.sh b/hyakvnc.sh index e7576c6..149ee7c 100755 --- a/hyakvnc.sh +++ b/hyakvnc.sh @@ -1,5 +1,6 @@ #! /usr/bin/env bash +HYAKVNC_VERSION="0.3.0" if [ -n "${XDEBUG:-}" ]; then set -x fi @@ -971,8 +972,49 @@ mkdir -p "${HYAKVNC_DIR}/pids" || (log ERROR "Failed to create HYAKVNC PIDs dire # If the first argument is a function in this file, set it to the action: -ACTION="${1:-help}" -shift +while true; do + case "${1:-}" in + -h | --help | help) + cmd_help + return 0 + ;; + -d | --debug) # Debug mode + shift + export HYAKVNC_LOG_LEVEL=2 + ;; + -V | --version) + shift + echo "HyakVNC version ${HYAKVNC_VERSION}" + return 0 + ;; + create) + shift + help_create "$@" + + return 0 + ;; + status) + shift + help_status "$@" + return 0 + ;; + stop) + shift + help_stop "$@" + return 0 + ;; + show) + shift + help_show "$@" + return 0 + ;; + help) + shift + cmd_help "$@" + ;; + + esac +done if compgen -A function | grep -qE "^cmd_${ACTION}$"; then "cmd_${ACTION}" "$@"