aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hydra/misc35
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 $*
}