summaryrefslogtreecommitdiff
path: root/bin/pkg
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-11-26 18:56:00 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2008-11-26 18:56:00 +0100
commit40cb22fb40e01f92fc4d7511e23ca1a3c21ae29c (patch)
treeb0799abe1d5d4332547a6a2172a5223131c99f2c /bin/pkg
parentefe7708a906daf792316559959c789f2d7f85fa6 (diff)
pkg: Added commandline options
No completion for now, though, since something does not quite work there
Diffstat (limited to 'bin/pkg')
-rwxr-xr-xbin/pkg23
1 files changed, 20 insertions, 3 deletions
diff --git a/bin/pkg b/bin/pkg
index f1b1867..09c94af 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -70,6 +70,26 @@ if [[ -f $HOME/.pkg.conf ]] {
export PDIR
export PKG_ROOT
+##
+## commandline parsing
+##
+
+# commandline options override everything else
+while [[ $1 == [-+]* ]] {
+ case $1 in
+ -q|--quiet) SILENT=1 ;;
+ +q|--no-quiiet) SILENT=0 ;;
+ -au|--auto-update) AUTOUPDATE=1 ;;
+ +au|--no-auto-update) AUTOUPDATE=0 ;;
+ -co|--checklinks-options) CL_OPTIONS+=$1; shift ;;
+ -p|--packagedir) PDIR=$1; shift ;;
+ *) die "Unknown argument: '$1'\n" ;;
+ esac
+ shift
+}
+
+action=$1
+shift
##
## Make sure everything's sane
@@ -691,9 +711,6 @@ function pkg_log {
# Note:
# wrap foobar "$1" <- the "" are neccessary here, since $1 is optional (and therefore may be empty)
-
-action=$1
-shift
case $action in
add) pkg_add $* ;;
delete) pkg_remove $* ;;