commit 4da37a2095f88ba90c8116edd0b23baceecd40f3
parent e0b78be6bdbc9b281c26be629f509e1f71606631
Author: Cem Keylan <cem@ckyln.com>
Date: Fri, 24 Jul 2020 11:22:11 +0300
cpt: handle utilities in its own variable
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cpt b/cpt
@@ -3,7 +3,8 @@
if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./lib.sh; fi
-case "$1" in
+[ "$1" ] && { arg=$1; shift; }
+case "$arg" in
--help|-h|'')
log "Carbs Packaging Tool"
set --
@@ -12,7 +13,7 @@ case "$1" in
max=$((${#1} > max ? ${#1} : max))
done
- for path in "$@"; do
+ for path; do
# These are binary files so they should be ignored
contains "readlink stat" "$path" && continue
@@ -27,7 +28,7 @@ case "$1" in
util=$(SEARCH_PATH=$PATH pkg_find "cpt-$1"* "" -x 2>/dev/null) ||
die "'cpt $action' is not a valid command"
- shift; "$util" "$@"
+ "$util" "$@"
;;
esac