diff options
Diffstat (limited to 'hatch_complete.sh')
-rw-r--r-- | hatch_complete.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hatch_complete.sh b/hatch_complete.sh new file mode 100644 index 000000000000..0ce2d9886b88 --- /dev/null +++ b/hatch_complete.sh @@ -0,0 +1,21 @@ +_hatch_completion() { + local IFS=$' +' + COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ + COMP_CWORD=$COMP_CWORD \ + _HATCH_COMPLETE=complete $1 ) ) + return 0 +} + +_hatch_completionetup() { + local COMPLETION_OPTIONS="" + local BASH_VERSION_ARR=(${BASH_VERSION//./ }) + # Only BASH version 4.4 and later have the nosort option. + if [ ${BASH_VERSION_ARR[0]} -gt 4 ] || ([ ${BASH_VERSION_ARR[0]} -eq 4 ] && [ ${BASH_VERSION_ARR[1]} -ge 4 ]); then + COMPLETION_OPTIONS="-o nosort" + fi + + complete $COMPLETION_OPTIONS -F _hatch_completion hatch +} + +_hatch_completionetup; |