From 423657b8f37be223089de9b3090e4baa1b809742 Mon Sep 17 00:00:00 2001 From: Marian Krcmarik Date: Mon, 9 Mar 2015 20:56:25 +0100 Subject: [PATCH] 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 --- etc/rally.bash_completion | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/rally.bash_completion b/etc/rally.bash_completion index 8bb8ef0f..565c8040 100644 --- a/etc/rally.bash_completion +++ b/etc/rally.bash_completion @@ -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[*]}"