Add another variable for storing the command sent to Redis
This commit is contained in:
parent
c56d452dc1
commit
61ccf79c25
14
lib/cli.sh
14
lib/cli.sh
|
@ -6,14 +6,14 @@ get_cmd() {
|
|||
|
||||
parse_cmd() {
|
||||
local cmd=( ) arg
|
||||
declare -n serialized=$1
|
||||
declare -n cmd_sent=$1
|
||||
declare -n serialized=$2
|
||||
|
||||
route_cmd "$2"
|
||||
route_cmd "$3"
|
||||
|
||||
serialized=*${#cmd[@]}$'\r\n'
|
||||
serialized+=${cmd[0]^^}
|
||||
|
||||
for arg in "${cmd[@]:1}"; do
|
||||
for arg in "${cmd[@]}"; do
|
||||
serialized+=$arg
|
||||
done
|
||||
}
|
||||
|
@ -55,6 +55,12 @@ parse_word() {
|
|||
fi
|
||||
done
|
||||
|
||||
if ! (( ${#cmd[@]} )); then
|
||||
cmd_sent=${arg^^}
|
||||
cmd+=( "\$${#arg}"$'\r\n'"$cmd_sent"$'\r\n' )
|
||||
else
|
||||
cmd+=( "\$${#arg}"$'\r\n'"$arg"$'\r\n' )
|
||||
fi
|
||||
|
||||
route_cmd "$line"
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ fi
|
|||
###
|
||||
|
||||
while get_cmd line; do
|
||||
parse_cmd redis_cmd "$line"
|
||||
redis_send "$redis_cmd"
|
||||
parse_cmd redis_cmd redis_line "$line"
|
||||
redis_send "$redis_line"
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue