commit 6c55165fd197d584aacc17e65cfc6568c17f5e46
parent 2801c5c1f7e9c175ee13e735999c0ed7a397250b
Author: Cem Keylan <cem@ckyln.com>
Date: Fri, 24 Jul 2020 14:15:06 +0300
cpt-install/remove: fix handling no-args
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git 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
@@ -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