aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-10-05 11:06:21 +0000
committermerakor <cem@ckyln.com>2020-10-05 11:06:21 +0000
commit7fb0102b1da5b14ab85b941f49ae171a303e7208 (patch)
treed0108ef5cdb694a6a09d938748affc22b4020651
parent39af6dbdc87390fa44600482fe6ed21d220e4a93 (diff)
downloadcpt-7fb0102b1da5b14ab85b941f49ae171a303e7208.tar.gz
cpt-list: add options
FossilOrigin-Name: 2a72f42a940b14d180eac94fda1610b8b29cbd66443b5f2d85a8e7f3eb85c1ac
-rwxr-xr-xsrc/cpt-list18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/cpt-list b/src/cpt-list
index 5179dc5..cbf8880 100755
--- a/src/cpt-list
+++ b/src/cpt-list
@@ -3,9 +3,19 @@
if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
-case "$1" in
- --help|-h) out "usage: ${0##*/} [pkg...]"; exit 1 ;;
- --version|-v) version ;;
-esac
+parser_definition() {
+ setup REST -- "usage: ${0##*/} [-c] [pkg...]"
+ msg -- '' 'Options:'
+ flag CURRENT -c --current -- "Use the current directory as a package"
+ global_options
+}
+
+eval "$(getoptions parser_definition parse "$0")"
+eval "$(getoptions_help parser_definition usage)"
+
+parse "$@"
+eval set -- "$REST"
+
+[ "$CURRENT" ] && set -- "${PWD##*/}"
pkg_list "$@"