Skip to content

Commit 18685e3

Browse files
scopakinomyoga
authored andcommitted
feat(bash_completion): scratch _comp_return_hook
1 parent 1ae8434 commit 18685e3

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
@@ -819,6 +819,14 @@ _comp_variable_assignments()
819819
return 0
820820
}
821821

822+
_comp_return_hook()
823+
{
824+
((${#FUNCNAME[*]} != 2)) && return # this _will_ need some refinement and thought
825+
echo "Hello from return hook for ${FUNCNAME[1]}"
826+
echo "words: ${words[@]}"
827+
echo "COMPREPLY: ${COMPREPLY[@]}"
828+
}
829+
822830
# Initialize completion and deal with various general things: do file
823831
# and variable completion where appropriate, and adjust prev, words,
824832
# and cword as if no redirections exist so that completions do not
@@ -838,6 +846,8 @@ _init_completion()
838846
{
839847
local exclude="" flag outx errx inx OPTIND=1
840848

849+
trap _comp_return_hook RETURN
850+
841851
while getopts "n:e:o:i:s" flag "$@"; do
842852
case $flag in
843853
n) exclude+=$OPTARG ;;

0 commit comments

Comments
 (0)