summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-04-20 19:27:56 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2009-04-20 19:27:56 +0200
commitb8268443b44ac0f4c6964d36a4f91d014399cb41 (patch)
tree969a6b9f9ceb814827090c6593b8d5620b962cb2
parentd4e4a84e83904ce8568440cac631f758fc2bf807 (diff)
pkg: Added --packageroot option
-rwxr-xr-xbin/pkg30
-rw-r--r--man/1/pkg4
-rw-r--r--provides/zsh/completions/_pkg11
3 files changed, 23 insertions, 22 deletions
diff --git a/bin/pkg b/bin/pkg
index c6ae12f..a059046 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -73,23 +73,7 @@ if [[ -f $HOME/.pkg.conf ]] {
. $HOME/.pkg.conf
}
-# Default values... or not
-[[ -n $PKG_ROOT ]] || die "No PKG_ROOT specified. Please edit ~/.pkg.conf\n"
-: ${PDIR:="$HOME/packages"}
-: ${CL_OPTIONS:=-q}
-: ${SILENT=0}
-: ${DEBUG=0}
-: ${AUTOUPDATE=1}
-: ${GIT_USE_ORIGIN=1}
-
-export PDIR
-export PKG_ROOT
-
-##
-## commandline parsing
-##
-
-# commandline options override everything else
+# Parse commandline options
while [[ $1 == --* ]] {
case $1 in
--quiet) SILENT=1 ;;
@@ -100,6 +84,7 @@ while [[ $1 == --* ]] {
--no-auto-update) AUTOUPDATE=0 ;;
--checklinks-options) CL_OPTIONS+=$2; shift ;;
--packagedir) PDIR=$2; shift ;;
+ --packageroot) PKG_ROOT=$2; shift ;;
*) die "Unknown argument: '$1'\n" ;;
esac
shift
@@ -108,6 +93,17 @@ while [[ $1 == --* ]] {
action=$1
shift
+# Default values... or not
+[[ -n $PKG_ROOT ]] || die "No PKG_ROOT specified. Please edit ~/.pkg.conf\n"
+: ${PDIR:="$HOME/packages"}
+: ${CL_OPTIONS:=-q}
+: ${SILENT=0}
+: ${DEBUG=0}
+: ${AUTOUPDATE=1}
+: ${GIT_USE_ORIGIN=1}
+export PDIR
+export PKG_ROOT
+
# Avoid calling debug without debug mode... just in case one needs more speed
if (( !DEBUG )) {
unalias debug
diff --git a/man/1/pkg b/man/1/pkg
index 049ae72..8476279 100644
--- a/man/1/pkg
+++ b/man/1/pkg
@@ -120,6 +120,10 @@ Only one option is allowed. To append more options, repeat the argument
Use I<directory> as local package directory
+=item B<--packageroot> I<URL>
+
+Use I<URL> as package root
+
=back
=head1 FILES
diff --git a/provides/zsh/completions/_pkg b/provides/zsh/completions/_pkg
index b36067b..d3dbd58 100644
--- a/provides/zsh/completions/_pkg
+++ b/provides/zsh/completions/_pkg
@@ -74,10 +74,11 @@ function _pkg_args {
}
_arguments \
- {-q,--quiet}'[quiet mode]' \
- {-d,--debug}'[debugmode]' \
- {-au,--auto-update}'[automatically update package list]' \
- '*'{-co,--checklinks-options}'[options for checklinks]:option' \
- {-p,--packagedir}'[package directory]:directory:_files -/' \
+ '--quiet[quiet mode]' \
+ '--debug[debugmode]' \
+ '--auto-update[automatically update package list]' \
+ '*--checklinks-options[options for checklinks]:option' \
+ '--packagedir[package directory]:directory:_files -/' \
+ '--packageroot[package root]:url' \
':action:_pkg_action' \
'*::arguments:_pkg_args'