2013-05-16 04:00:01 +04:00
|
|
|
function _mach()
|
|
|
|
{
|
2019-01-11 18:28:49 +03:00
|
|
|
local cur targets
|
2013-05-16 04:00:01 +04:00
|
|
|
COMPREPLY=()
|
|
|
|
|
2019-01-11 18:28:49 +03:00
|
|
|
# Calling `mach-completion` with -h/--help would result in the
|
|
|
|
# help text being used as the completion targets.
|
|
|
|
if [[ $COMP_LINE == *"-h"* || $COMP_LINE == *"--help"* ]]; then
|
|
|
|
return 0
|
2013-05-16 04:00:01 +04:00
|
|
|
fi
|
|
|
|
|
2019-01-11 18:28:49 +03:00
|
|
|
# Load the list of targets
|
|
|
|
targets=`"${COMP_WORDS[0]}" mach-completion ${COMP_LINE}`
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
COMPREPLY=( $(compgen -W "$targets" -- ${cur}) )
|
2013-05-16 04:00:01 +04:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -o default -F _mach mach
|