Skip to content

Commit

Permalink
Merge topic 'updated-workflow-bash-completion' into release-3.31
Browse files Browse the repository at this point in the history
3ae0319 bash-completion: Complete a workflow name after the --workflow option

Acked-by: Kitware Robot <[email protected]>
Merge-request: !9943
  • Loading branch information
bradking authored and kwrobot committed Oct 29, 2024
2 parents f4712b8 + 3ae0319 commit 7b47da6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Auxiliary/bash-completion/cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b47da6

Please sign in to comment.