blob: d009f738a8db9f3d433fcaa44a7dc948cd00d008 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|