aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-07-24 11:19:09 +0000
committermerakor <cem@ckyln.com>2020-07-24 11:19:09 +0000
commit98f546d542dc5bacfc46590d148a1adcfa908c95 (patch)
tree978996966a27c4a8d70b5df5dbacec87b19386c9
parent0b4456b8aedf3a6198433239eae2f774d0557a3f (diff)
downloadcpt-98f546d542dc5bacfc46590d148a1adcfa908c95.tar.gz
cpt: reserve arguments
FossilOrigin-Name: d030f24afff5c263e9e8bf8f79bb47b348cadf57dc66b6026c9ad505a0693c17
-rwxr-xr-xcpt26
1 files changed, 18 insertions, 8 deletions
diff --git a/cpt b/cpt
index 63bab84..3add8b6 100755
--- a/cpt
+++ b/cpt
@@ -20,15 +20,25 @@ case "$arg" in
printf "%b->%b %-${max}s " "${color:+\033[1;31m}" "${color:+\033[m}" "${path#*/cpt-}"
sed -n 's/^# *//;2p' "$(command -v "cpt-$path")"
done | sort -uk1 >&2
+ exit
;;
- --version|-v) version ;;
-
- *)
- util=$(SEARCH_PATH=$PATH pkg_find "cpt-$arg"* "" -x 2>/dev/null) ||
- die "'cpt $arg' is not a valid command"
+ --version|-v|version) version ;;
+
+ # Reserve these arguments for the following tools.
+ a) arg=alternatives ;;
+ b) arg=build ;;
+ c) arg=checksum ;;
+ d) arg=download ;;
+ f) arg=fetch ;;
+ i) arg=install ;;
+ l) arg=list ;;
+ r) arg=remove ;;
+ s) arg=search ;;
+ u) arg=update ;;
+esac
- "$util" "$@"
- ;;
+util=$(SEARCH_PATH=$PATH pkg_find "cpt-$arg"* "" -x 2>/dev/null) ||
+ die "'cpt $arg' is not a valid command"
-esac
+"$util" "$@"