summaryrefslogtreecommitdiffstats
path: root/autocluster
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-06-20 15:02:59 +1000
committerMartin Schwenke <martin@meltin.net>2014-06-25 20:46:16 +1000
commit98bf844fae2d32d3d30f1bdfd7c30dd6bdae3082 (patch)
treedf710d603a25f692eae59ed4156b51e70c9b65df /autocluster
parent36bf4c5f3a91bcb77c1d938f803d91dc6572ce0b (diff)
downloadautocluster-98bf844fae2d32d3d30f1bdfd7c30dd6bdae3082.tar.gz
autocluster-98bf844fae2d32d3d30f1bdfd7c30dd6bdae3082.tar.xz
autocluster-98bf844fae2d32d3d30f1bdfd7c30dd6bdae3082.zip
Allow command line with noun first and (potentially) multiple verbs
Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'autocluster')
-rwxr-xr-xautocluster46
1 files changed, 46 insertions, 0 deletions
diff --git a/autocluster b/autocluster
index 7afb74b..6fc78f3 100755
--- a/autocluster
+++ b/autocluster
@@ -52,6 +52,10 @@ EOF
cat <<EOF
commands:
+ base [ create | boot ] ...
+
+ cluster create
+
create base
create a base image
@@ -1154,6 +1158,26 @@ usage_config_options (){
usage_smart_display load_config
}
+actions_init ()
+{
+ actions=""
+}
+
+actions_add ()
+{
+ actions="${actions}${actions:+ }$*"
+}
+
+actions_run ()
+{
+ [ -n "$actions" ] || usage
+
+ local a
+ for a in $actions ; do
+ $a
+ done
+}
+
######################################################################
post_config_hooks=
@@ -1248,6 +1272,28 @@ t="$1"
shift
case "$t" in
+ base)
+ actions_init
+ for t in "$@" ; do
+ case "$t" in
+ create|boot) actions_add "base_${t}" ;;
+ *) usage ;;
+ esac
+ done
+ actions_run
+ ;;
+
+ cluster)
+ actions_init
+ for t in "$@" ; do
+ case "$t" in
+ create) actions_add "cluster_${t}" ;;
+ *) usage ;;
+ esac
+ done
+ actions_run
+ ;;
+
create)
t="$1"
shift