Skip to content
Permalink
Browse files
step3: replace conditional with data structures
  • Loading branch information
jdvr committed Jul 28, 2017
1 parent eb7fb83 commit 22fab6187380f5a0bb6f74c6bf79fae1506f6a79
Showing 1 changed file with 10 additions and 37 deletions.
@@ -20,46 +20,19 @@ fi
# Computed vars
ENDPORT=$((PORT+NODES))

declare -A commands

if [ "$1" == "start" ]
then
start_command
fi
commands[start]=start_command
commands[create]=create_command
commands[stop]=stop_command
commands[watch]=watch_command
commands[tail]=tail_command
commands[call]=call_command
commands[clean]=clean_command
commands[clean-logs]=clean_logs_command

if [ "$1" == "create" ]
then
create_command
fi
${commands[$1]}

if [ "$1" == "stop" ]
then
stop_command
fi

if [ "$1" == "watch" ]
then
watch_command
fi

if [ "$1" == "tail" ]
then
tail_command
fi

if [ "$1" == "call" ]
then
call_command
fi

if [ "$1" == "clean" ]
then
clean_command
fi

if [ "$1" == "clean-logs" ]
then
clean_logs_command
fi

echo "Usage: $0 [start|create|stop|watch|tail|clean]"
echo "start -- Launch Redis Cluster instances."

0 comments on commit 22fab61

Please sign in to comment.