summaryrefslogtreecommitdiffstats
path: root/python/mach/bash-completion.sh
blob: 13935cf88cd25c7526f51c8759372315dd423c7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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