mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
8905ad4bab
Since we're calling into a mach command for the current completion implementation anyway (and incurring python startup penalties), we might as well move all the bash logic into the mach command. The new 'mach-completion' command was created in case there are scripts relying on the current behaviour of 'mach-commands'. Depends on D16254 Differential Revision: https://phabricator.services.mozilla.com/D16255 --HG-- extra : moz-landing-system : lando
19 lines
478 B
Bash
19 lines
478 B
Bash
function _mach()
|
|
{
|
|
local cur targets
|
|
COMPREPLY=()
|
|
|
|
# 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
|
|
fi
|
|
|
|
# Load the list of targets
|
|
targets=`"${COMP_WORDS[0]}" mach-completion ${COMP_LINE}`
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
COMPREPLY=( $(compgen -W "$targets" -- ${cur}) )
|
|
return 0
|
|
}
|
|
complete -o default -F _mach mach
|