-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This includes dynamic URI completion of known URI's and aliases. Note: Alias complete doesn't work for env/activate. It requires working around click's default parsing implementation.
- Loading branch information
1 parent
44f4094
commit 5e44ff2
Showing
5 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters