aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-07-24 11:15:06 +0000
committermerakor <cem@ckyln.com>2020-07-24 11:15:06 +0000
commit0b4456b8aedf3a6198433239eae2f774d0557a3f (patch)
treebc735ba9ab9fec99f1de73db75a855f6f8db6dd7 /tools
parentc36e4a2ecc9d0ae7b8e387879d367ae70a0d3be6 (diff)
downloadcpt-0b4456b8aedf3a6198433239eae2f774d0557a3f.tar.gz
cpt-install/remove: fix handling no-args
FossilOrigin-Name: 875434ad1a12b071fed1a501afe8dc6e8ce19bb3a3ee10081758a46649e0db25
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cpt-install3
-rwxr-xr-xtools/cpt-remove3
2 files changed, 4 insertions, 2 deletions
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