[152527] contrib/mp-buildbot/mpbb
larryv at macports.org
larryv at macports.org
Sun Sep 11 18:59:00 PDT 2016
Revision: 152527
https://trac.macports.org/changeset/152527
Author: larryv at macports.org
Date: 2016-09-11 18:59:00 -0700 (Sun, 11 Sep 2016)
Log Message:
-----------
mpbb: Search command array for subcommands
Conceptually, the "cmds" array should be the canonical reference for
available subcommands. The sourced scripts are just used to construct
that array.
Modified Paths:
--------------
contrib/mp-buildbot/mpbb
Modified: contrib/mp-buildbot/mpbb
===================================================================
--- contrib/mp-buildbot/mpbb 2016-09-12 01:58:58 UTC (rev 152526)
+++ contrib/mp-buildbot/mpbb 2016-09-12 01:59:00 UTC (rev 152527)
@@ -176,9 +176,14 @@
usage
fi
-command=$1
+subcmd=$1
shift
-if [[ ! -f "$thisdir/mpbb-$command" ]]; then
+
+# This loop exits with 0 if cmds contains subcmd or is empty.
+for cmd in "${cmds[@]}"; do
+ [[ $cmd == "$subcmd" ]] && break
+done
+if (( $? != 0 || ${#cmds[@]} == 0 )); then
err "Unknown command \`$command'"
usage
fi
@@ -189,13 +194,13 @@
fi
## Otherwise, run the command and deal with errors
-PORTSRC=${option_work_dir}/macports.conf "$command" "$@"
+PORTSRC=${option_work_dir}/macports.conf "$subcmd" "$@"
readonly rc=$?
case $rc in
0)
;;
*)
- err "\`$command' failed to run successfully"
+ err "\`$subcmd' failed to run successfully"
;;
esac
exit $rc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160911/90767d8d/attachment.html>
More information about the macports-changes
mailing list