From 0b4456b8aedf3a6198433239eae2f774d0557a3f Mon Sep 17 00:00:00 2001 From: merakor Date: Fri, 24 Jul 2020 11:15:06 +0000 Subject: cpt-install/remove: fix handling no-args FossilOrigin-Name: 875434ad1a12b071fed1a501afe8dc6e8ce19bb3a3ee10081758a46649e0db25 --- tools/cpt-install | 3 ++- tools/cpt-remove | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/cpt-install b/tools/cpt-install index d74085f..0fe2484 100755 --- a/tools/cpt-install +++ b/tools/cpt-install @@ -4,6 +4,8 @@ # shellcheck disable=1091 if command -v cpt-lib >/dev/null; then . cpt-lib; else . ../lib.sh; fi +[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH + while [ "$1" ]; do case "$1" in --help|-h) @@ -18,7 +20,6 @@ while [ "$1" ]; do --root) export CPT_ROOT=$2; shift 2 ;; --) break ;; -*) die "Unknown argument '$1'" ;; - '') set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;; *) break ;; esac done diff --git a/tools/cpt-remove b/tools/cpt-remove index 803fd36..543f8b8 100755 --- a/tools/cpt-remove +++ b/tools/cpt-remove @@ -4,6 +4,8 @@ # shellcheck disable=1091 if command -v cpt-lib >/dev/null; then . cpt-lib; else . ../lib.sh; fi +[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH + while [ "$1" ]; do case "$1" in --help|-h) @@ -18,7 +20,6 @@ while [ "$1" ]; do --root) export CPT_ROOT=$2; shift 2 ;; --) break ;; -*) die "Unknown argument '$1'" ;; - '') set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;; *) break ;; esac done -- cgit v1.2.3