Fix bash autocompletion of "rally task sla_check"

Character "_" is used as delimiter of commands and
their subcommands stored in bash array as keys,
i.e. in form "task_sla_check". Current code splits
it into an array based on delimiter "_" which would
return array with three values - task, sla and check.
The patch takes first value from the beginning to
first "_" as command and the rest as its subcommand.

Change-Id: I7d8c9b1eeb7c28ef24b0f2f366c6a18930282be5
Closes-bug: 1401180
This commit is contained in:
Marian Krcmarik 2015-03-09 20:56:25 +01:00
parent ec6131381d
commit 423657b8f3

View File

@ -50,8 +50,9 @@ _rally()
for OPT in ${!OPTS[*]} ; do
CMDSUB=(${OPT//_/ })
SUBCOMMANDS[${CMDSUB[0]}]+="${CMDSUB[1]} "
CMD=${OPT%%_*}
CMDSUB=${OPT#*_}
SUBCOMMANDS[${CMD}]+="${CMDSUB} "
done
COMMANDS="${!SUBCOMMANDS[*]}"