diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-11-01 15:04:12 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-11-01 15:04:12 -0200 |
commit | ae81b5792157b0e9828dec0264c906f65159c47e (patch) | |
tree | 3079c1c4e808caa98e53c7858c72430ca9d15464 | |
parent | 69ba766373b5247cf28eb8aa4308ac679b1b5c71 (diff) | |
download | hydra-ae81b5792157b0e9828dec0264c906f65159c47e.tar.gz hydra-ae81b5792157b0e9828dec0264c906f65159c47e.tar.bz2 |
Usage functions
-rwxr-xr-x | hydra | 5 | ||||
-rw-r--r-- | lib/hydra/misc | 18 |
2 files changed, 15 insertions, 8 deletions
@@ -49,7 +49,8 @@ function hydra_load { source $APP_BASE/lib/hydra/functions || exit 1 } -# Basename +# Name and basename configuration +NAME="hydra" BASENAME="`basename $0`" # Adjust hydra parameter @@ -63,7 +64,7 @@ hydra_load $* # Command-line parser if [ -z "$ACTION" ]; then - echo "usage: $BASENAME [hydra] <command> [arguments]" + hydra_action_usage exit 1 fi diff --git a/lib/hydra/misc b/lib/hydra/misc index 88ffec1..4695d5f 100644 --- a/lib/hydra/misc +++ b/lib/hydra/misc @@ -70,12 +70,7 @@ function hydra_exec { # Set needed environment variables and do basic checks. function hydra_set_env { - if [ -z "$1" ]; then - echo "Error: missing arguments for hydra_set_env" - exit 1 - fi - - ACTION="$1" + export ACTION="$1" } # Get a command argument @@ -100,6 +95,17 @@ function hydra_action_usage { fi } +# Action dispatcher function hydra_dispatch { hydra_exec $ACTION $* } + +# Hydra usage +function hydra_usage_hydra { + echo "Usage: hydra [hydra] <command> [arguments]" +} + +# Hydra ctl usage +function hydra_usage_hydractl { + echo "Usage: hydractl <command> [arguments]" +} |