-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.hab-complete.bash
37 lines (28 loc) · 1.04 KB
/
.hab-complete.bash
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
33
34
35
36
37
# This script enables tab completion for hab in bash. It requires bash 4.4+.
# https://click.palletsprojects.com/en/8.1.x/shell-completion/
# To enable tab completion source this script in your .bashrc script.
# `. /c/Program\ Files/Python39/Scripts/.hab-complete.bash`
# `. /usr/local/bin/.hab-complete.bash`
# This script below was generated by running `_HAB_COMPLETE=bash_source hab > .hab-complete.bash`
_hab_completion() {
local IFS=$'\n'
local response
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _HAB_COMPLETE=bash_complete $1)
for completion in $response; do
IFS=',' read type value <<< "$completion"
if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done
return 0
}
_hab_completion_setup() {
complete -o nosort -F _hab_completion hab
}
_hab_completion_setup;