]> pd.if.org Git - zpackage/commitdiff
add -P option to zpm to add to exec path
authorNathan Wagner <nw@hydaspes.if.org>
Mon, 9 Apr 2018 05:55:46 +0000 (00:55 -0500)
committerNathan Wagner <nw@hydaspes.if.org>
Tue, 10 Apr 2018 07:10:14 +0000 (02:10 -0500)
zpm

diff --git a/zpm b/zpm
index 389931b0e15d12bf97873110ed3af0b7418a3e93..129c72ac5c5f717e19287fd1fc176936b09889d8 100755 (executable)
--- a/zpm
+++ b/zpm
@@ -1,6 +1,17 @@
 #!/bin/sh
 
-PATH="$PATH:/usr/libexec/zpm"
+# parse command line options
+while getopts P: opt; do
+       case $opt in
+               P) PATH=$PATH:$OPTARG ;;
+               *) printf "zpm unknown option '%s'\n" "$opt"; exit 1 ;;
+       esac
+done
+shift $((OPTIND - 1))
+
+: ${ZPMPATH:=/usr/libexec/zpm}
+
+PATH="$PATH:$ZPMPATH"
 export PATH
 
 [ -z "$1" ] && set help
@@ -12,8 +23,6 @@ die() {
        exit 1;
 }
 
-# parse command line options
-
 # read in config files
 
 test -r /etc/zpmrc && . /etc/zpmrc