bash-completion.sh (715B)
1 # Is bash completion too slow to your taste? 2 # Consider generating fast completion scripts with: 3 # ./mach mach-completion bash -f path/to/mach.bash-completion 4 # See https://firefox-source-docs.mozilla.org/mach/usage.html#tab-completion 5 6 function _mach() 7 { 8 local cur targets 9 COMPREPLY=() 10 11 # Calling `mach-completion` with -h/--help would result in the 12 # help text being used as the completion targets. 13 if [[ $COMP_LINE == *"-h"* || $COMP_LINE == *"--help"* ]]; then 14 return 0 15 fi 16 17 # Load the list of targets 18 targets=`"${COMP_WORDS[0]}" mach-completion ${COMP_LINE}` 19 cur="${COMP_WORDS[COMP_CWORD]}" 20 COMPREPLY=( $(compgen -W "$targets" -- ${cur}) ) 21 return 0 22 } 23 complete -o default -F _mach mach