bash-completion: Complete a workflow name after the --workflow option

Update bash completion for commit b80aa1d3a3 (preset: Easier command
line interface for Workflow Presets, 2024-09-30, v3.31.0-rc1~17^2).

Issue: #26270
This commit is contained in:
Alex Turbov 2024-10-24 20:47:53 +04:00
parent 81f49865f2
commit 3ae031992a
No known key found for this signature in database
GPG Key ID: 8BEDB7D11F95D5E3

View File

@ -201,6 +201,24 @@ _cmake()
COMPREPLY=( $( compgen -W "$presets" -- "$quoted" ) )
return
;;
--workflow)
local quoted
printf -v quoted %q "$cur"
# Options allowed right after `--workflow`
local workflow_options='--preset --list-presets --fresh'
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$workflow_options" -- "$quoted" ) )
else
local presets=$( cmake --list-presets=workflow 2>/dev/null |
grep -o "^ \".*\"" | sed \
-e "s/^ //g" \
-e "s/\"//g" \
-e 's/ /\\\\ /g' )
COMPREPLY=( $( compgen -W "$presets $workflow_options" -- "$quoted" ) )
fi
return
;;
esac
if ($is_old_completion || $is_init_completion); then