aboutsummaryrefslogtreecommitdiff
path: root/src/cpt-build
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpt-build')
-rwxr-xr-xsrc/cpt-build20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/cpt-build b/src/cpt-build
index a143b67..0a4326b 100755
--- a/src/cpt-build
+++ b/src/cpt-build
@@ -4,11 +4,21 @@
# shellcheck disable=1091
if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi
-case "$1" in
- '') set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;;
- --help|-h) out "usage: ${0##*/} [pkg...]"; exit 1 ;;
- --version|-v) version ;;
-esac
+eval set -- "$(getopt -l no-prompt,version,help -- yvh "$@")"
+while :; do
+ case "$1" in
+ --help|-h)
+ out "usage: ${0##*/} [pkg...]" "" \
+ " Options:" \
+ " -y --no-prompt Do not prompt for confirmation" \
+ exit 1 ;;
+ --version|-v) version ;;
+ --no-prompt|-y) export CPT_PROMPT=0; shift ;;
+ --) shift; break ;;
+ esac
+done
+
+[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH
create_cache