Skip to content

Commit 125792d

Browse files
scopakinomyoga
authored andcommitted
feat(bash_completion): scratch _comp_return_hook
1 parent 966a4e0 commit 125792d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bash_completion

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,14 @@ _comp_variable_assignments()
881881
return 0
882882
}
883883

884+
_comp_return_hook()
885+
{
886+
((${#FUNCNAME[*]} != 2)) && return # this _will_ need some refinement and thought
887+
echo "Hello from return hook for ${FUNCNAME[1]}"
888+
echo "words: ${words[@]}"
889+
echo "COMPREPLY: ${COMPREPLY[@]}"
890+
}
891+
884892
# Initialize completion and deal with various general things: do file
885893
# and variable completion where appropriate, and adjust prev, words,
886894
# and cword as if no redirections exist so that completions do not
@@ -900,6 +908,8 @@ _init_completion()
900908
{
901909
local exclude="" flag outx errx inx OPTIND=1
902910

911+
trap _comp_return_hook RETURN
912+
903913
while getopts "n:e:o:i:s" flag "$@"; do
904914
case $flag in
905915
n) exclude+=$OPTARG ;;

0 commit comments

Comments
 (0)