From 7f60c243b746c13f8678b796b252caab52d641f2 Mon Sep 17 00:00:00 2001 From: joglomedia Date: Tue, 3 Sep 2019 21:18:03 +0700 Subject: [PATCH] enhance lemper cli --- bin/lemper-cli.sh | 31 ++++++++++++++++++------------- lib/lemper-create.sh | 2 +- lib/lemper-manage.sh | 16 ++++++++-------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/bin/lemper-cli.sh b/bin/lemper-cli.sh index 1603cccc..8da2268f 100755 --- a/bin/lemper-cli.sh +++ b/bin/lemper-cli.sh @@ -18,25 +18,30 @@ set -e # Version control -ProgName=$(basename "$0") -ProgVersion="1.2.0-dev" +APP_NAME=$(basename "$0") +APP_VERSION="1.3.0" LibDir="/usr/local/lib/lemper" function cmd_help() { - echo "Usage: $ProgName [--version] [--help]" - echo " []" - echo "" - echo "These are common $ProgName commands used in various situations:" - echo " create Create new virtual host" - echo " manage Enable, disable, delete existing virtual host" - echo "" - echo "For help with each command run:" - echo "$ProgName -h|--help" +cat <<- _EOF_ +${APP_NAME^} ${APP_VERSION} +Command line management tool for LEMPer stack. + +Usage: $APP_NAME [--version] [--help] + [] + +These are common $APP_NAME commands used in various situations: + create Create new virtual host + manage Enable, disable, delete existing virtual host + +For help with each command run: +$APP_NAME -h|--help +_EOF_ } function cmd_version() { - echo "$ProgName version $ProgVersion" + echo "$APP_NAME version $APP_VERSION" } function cmd_create() { @@ -73,7 +78,7 @@ case ${SubCommand} in "cmd_${SubCommand}" "$@" else echo "Error: '${SubCommand}' is not a known command." >&2 - echo " Run '${ProgName} --help' for a list of known commands." >&2 + echo " Run '${APP_NAME} --help' for a list of known commands." >&2 exit 1 fi ;; diff --git a/lib/lemper-create.sh b/lib/lemper-create.sh index 9b41ff5d..fc22a05d 100755 --- a/lib/lemper-create.sh +++ b/lib/lemper-create.sh @@ -20,7 +20,7 @@ set -e # Version Control. APP_NAME=$(basename "$0") -APP_VERSION="1.2.0" +APP_VERSION="1.3.0" CMD_PARENT="lemper-cli" CMD_NAME="create" diff --git a/lib/lemper-manage.sh b/lib/lemper-manage.sh index 9517c36f..14f7adb4 100755 --- a/lib/lemper-manage.sh +++ b/lib/lemper-manage.sh @@ -19,7 +19,7 @@ set -e # Version control APP_NAME=$(basename "$0") -APP_VERSION="1.2.0" +APP_VERSION="1.3.0" CMD_PARENT="lemper-cli" CMD_NAME="manage" @@ -104,8 +104,8 @@ fi function show_usage() { cat <<- _EOF_ ${APP_NAME^} ${APP_VERSION} -Simple NGiNX virtual host (vHost) manager -enable/disable/remove NGiNX vHost config file on Debian/Ubuntu Server. +Simple NGiNX virtual host (vHost) manager, +enable/disable/remove NGiNX vHost on Debian/Ubuntu Server. Requirements: * LEMP stack setup uses [LEMPer](https://github.com/joglomedia/LEMPer) @@ -198,10 +198,6 @@ function remove_vhost() { echo "Removing virtual host is not reversible." read -t 30 -rp "Press [Enter] to continue..."