diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-11-01 14:17:59 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-11-01 14:17:59 -0200 |
commit | 69ba766373b5247cf28eb8aa4308ac679b1b5c71 (patch) | |
tree | 3f44fae3602c2df555309095ada9b41011bb1000 /lib | |
parent | b44f5147ebb4d06b9a2a3a0f85ff5b53a529ac98 (diff) | |
download | hydra-69ba766373b5247cf28eb8aa4308ac679b1b5c71.tar.gz hydra-69ba766373b5247cf28eb8aa4308ac679b1b5c71.tar.bz2 |
Fixing basic command line evaluation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hydra/misc | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/lib/hydra/misc b/lib/hydra/misc index 5691465..88ffec1 100644 --- a/lib/hydra/misc +++ b/lib/hydra/misc @@ -44,28 +44,27 @@ function hydra_config { # Check if there is a given action function hydra_has_action { - if [ -z "$ACTIONS" ]; then - echo "Your have to set ACTIONS variable in the code" - exit 1 - fi + if [ -z "$ACTIONS" ]; then + echo "Your have to set ACTIONS variable in the code" + exit 1 + fi - if [ -e "$ACTIONS/$1" ]; then - true - else - false - fi + if [ -e "$ACTIONS/$1" ]; then + true + else + false + fi } # Execute an action function hydra_exec { # Setup action="$1" - basedir="$2" shift 2 # Dispatch if hydra_has_action $action; then - $ACTIONS/$action $basedir $* + $ACTIONS/$action $* fi } @@ -75,6 +74,8 @@ function hydra_set_env { echo "Error: missing arguments for hydra_set_env" exit 1 fi + + ACTION="$1" } # Get a command argument @@ -100,15 +101,5 @@ function hydra_action_usage { } function hydra_dispatch { - BASEDIR="`hydra_config $KEYRING`" - - # Dispatch - if [ ! -z "$BASEDIR" ]; then - shift 2 - hydra_exec $ACTION $BASEDIR $* - exit $? - else - echo "No keydir configured for $KEYRING" - exit 1 - fi + hydra_exec $ACTION $* } |