Commit a1977414 authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

Fix completions script when suites have spaces

parent 5aeb75c9
No related merge requests found
Showing with 5 additions and 5 deletions
...@@ -72,20 +72,20 @@ _liblinphone_complete() { ...@@ -72,20 +72,20 @@ _liblinphone_complete() {
if [ $latest_is_empty = 0 ] && ! grep -q -- '^--' <<< "$latest_arg"; then if [ $latest_is_empty = 0 ] && ! grep -q -- '^--' <<< "$latest_arg"; then
# echo "yes!$prev_arg $has_not_set_suite" # echo "yes!$prev_arg $has_not_set_suite"
if [ "$prev_arg" = "--test" ] && [ $has_not_set_suite = 0 ]; then if [ "$prev_arg" = "--test" ] && [ $has_not_set_suite = 0 ]; then
suite_name=$(echo $@ | sed -nE 's/.*--suite ([^ ]*) .*/\1/p') suite_name=$(echo $@ | sed -nE 's/.*--suite (.*) (--.*)$/\1/p' |sed "s@\\\\@@g")
completions="$($program --list-tests "$suite_name" | grep "^$latest_arg")" completions="$($program --list-tests $suite_name | grep "^$latest_arg")"
elif [ "$prev_arg" = "--suite" ] || [ "$prev_arg" = "--list-tests" ]; then elif [ "$prev_arg" = "--suite" ] || [ "$prev_arg" = "--list-tests" ]; then
completions="$($program --list-suites)" completions="$($program --list-suites)"
fi fi
elif [ "$latest_arg" = "--test" ]; then elif [ "$latest_arg" = "--test" ]; then
if [ $has_not_set_suite = 0 ]; then if [ $has_not_set_suite = 0 ]; then
suite_name=$(echo $@ | sed -nE 's/.*--suite (.*) .*/\1/p') suite_name=$(echo $@ | sed -nE 's/.*--suite (.*) (--.*)$/\1/p' |sed "s@\\\\@@g")
completions="$($program --list-tests "$suite_name")" completions="$($program --list-tests $suite_name)"
fi fi
elif [ "$latest_arg" = "--suite" ] || [ "$latest_arg" = "--list-tests" ]; then elif [ "$latest_arg" = "--suite" ] || [ "$latest_arg" = "--list-tests" ]; then
completions="$($program --list-suites)" completions="$($program --list-suites)"
# we are waiting for a custom value, so do not hint anything # we are waiting for a custom value, so do not hint anything
elif grep -q -- "^$latest_arg$" <<< "$command_requiring_argument"; then elif [[ ! -z "$latest_arg" ]] && grep -q -- "^$latest_arg$" <<< "$command_requiring_argument"; then
completions="" completions=""
else else
completions="$available_tasks" completions="$available_tasks"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment