#!/bin/bash # 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 [ -e "$ACTIONS/$1" ]; then true else false fi } # Execute an action function hydra_exec { # Setup action="$1" shift 2 # Dispatch if hydra_has_action $action; then $ACTIONS/$action $* fi } # Get a command argument function hydra_get_command { # Aditional parameters COMMAND="$1" if [ -z "$COMMAND" ]; then hydra_action_usage command exit 1 fi } # Action dispatcher function hydra_dispatch { hydra_exec $ACTION $* }