diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/vcpkg_completion.bash | |
Diffstat (limited to 'vcpkg/scripts/vcpkg_completion.bash')
| -rw-r--r-- | vcpkg/scripts/vcpkg_completion.bash | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vcpkg/scripts/vcpkg_completion.bash b/vcpkg/scripts/vcpkg_completion.bash new file mode 100644 index 0000000..d009f73 --- /dev/null +++ b/vcpkg/scripts/vcpkg_completion.bash @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# set -x + +# To install: +# > vcpkg integrate bash +# This adds the following line to ~/.bashrc: +# source ~/vcpkg/scripts/vcpkg_completion.bash + +# Details: bash and utilities from bash-completion +# Bash commands: compgen, complete +# Input: COMP_WORDS, COMP_CWORD, COMP_LINE, COMP_POINT, COMP_KEY, COMP_WORDBREAKS +# Output: COMPREPLY + +_vcpkg_completions() +{ + local vcpkg_executable=${COMP_WORDS[0]} + local remaining_command_line=${COMP_LINE:(${#vcpkg_executable}+1)} + # echo "rem:$remaining_command_line" + + if [ $COMP_CWORD -eq 1 ]; then + local opts=$(${vcpkg_executable} autocomplete ${remaining_command_line}) + else + local opts=$(${vcpkg_executable} autocomplete ${remaining_command_line} --) + fi + #echo "opts:$opts" + + COMPREPLY=($(compgen -W "${opts}" -- ${COMP_WORDS[COMP_CWORD]}) ) + #echo "COMPREPLY:$COMPREPLY" +} + +complete -F _vcpkg_completions vcpkg + |