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