Add support for setting the base directory
This commit is contained in:
parent
413a23c405
commit
d2b6186736
|
@ -153,15 +153,16 @@ _error()
|
|||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: $PROGNAME_JOBS add command" 1>&2
|
||||
echo " $PROGNAME_JOBS exec" 1>&2
|
||||
echo " $PROGNAME_JOBS list" 1>&2
|
||||
echo "Usage: $PROGNAME_JOBS [-d directory] add command" 1>&2
|
||||
echo " $PROGNAME_JOBS [-d directory] exec" 1>&2
|
||||
echo " $PROGNAME_JOBS [-d directory] list" 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
while getopts "DO:" name; do
|
||||
directory=
|
||||
while getopts "DO:d:" name; do
|
||||
case "$name" in
|
||||
D)
|
||||
DEBUG="_debug"
|
||||
|
@ -169,6 +170,9 @@ while getopts "DO:" name; do
|
|||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
d)
|
||||
directory="$OPTARG"
|
||||
;;
|
||||
?)
|
||||
_usage
|
||||
exit $?
|
||||
|
@ -194,4 +198,8 @@ case "$1" in
|
|||
esac
|
||||
shift
|
||||
|
||||
if [ -n "$directory" ]; then
|
||||
(cd "$directory" && "$method" "$@")
|
||||
else
|
||||
"$method" "$@"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user