Allow multiple commands to be specified on a single command line, e.g.,
"portsnap fetch update" or "portsnap -I cron update". They will be executed in the order that they appear, and duplicates are not removed (so "portsnap fetch fetch fetch fetch" is meaningful, albeit rather silly). Requested by: Roman Divacky
This commit is contained in:
parent
716b138b4b
commit
d958d0d5dc
usr.sbin/portsnap/portsnap
@ -39,7 +39,7 @@
|
||||
.Op Fl k Ar KEY
|
||||
.Op Fl p Ar portsdir
|
||||
.Op Fl s Ar server
|
||||
.Cm command
|
||||
.Cm command ...
|
||||
.Op Ar path
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
|
@ -34,7 +34,7 @@
|
||||
# --no-stats -- don't show progress statistics while fetching files
|
||||
usage() {
|
||||
cat <<EOF
|
||||
usage: `basename $0` [options] command [path]
|
||||
usage: `basename $0` [options] command ... [path]
|
||||
|
||||
Options:
|
||||
-d workdir -- Store working files in workdir
|
||||
@ -72,6 +72,7 @@ init_params() {
|
||||
PORTSDIR=""
|
||||
CONFFILE=""
|
||||
COMMAND=""
|
||||
COMMANDS=""
|
||||
QUIETREDIR=""
|
||||
QUIETFLAG=""
|
||||
STATSREDIR=""
|
||||
@ -132,19 +133,20 @@ parse_cmdline() {
|
||||
shift; SERVERNAME="$1"
|
||||
;;
|
||||
cron | extract | fetch | update)
|
||||
if [ ! -z "${COMMAND}" ]; then usage; fi
|
||||
COMMAND="$1"
|
||||
COMMANDS="${COMMANDS} $1"
|
||||
;;
|
||||
*)
|
||||
if [ $# -gt 1 ]; then usage; fi
|
||||
if [ "${COMMAND}" = "extract" ]; then usage; fi
|
||||
if echo ${COMMANDS} | grep -vq extract; then
|
||||
usage
|
||||
fi
|
||||
EXTRACTPATH="$1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "${COMMAND}" ]; then
|
||||
if [ -z "${COMMANDS}" ]; then
|
||||
usage
|
||||
fi
|
||||
}
|
||||
@ -906,4 +908,6 @@ cmd_update() {
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${PATH}
|
||||
|
||||
get_params $@
|
||||
cmd_${COMMAND}
|
||||
for COMMAND in ${COMMANDS}; do
|
||||
cmd_${COMMAND}
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user