python/mach/bash-completion.sh

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 function _mach()
     2 {
     3   local cur cmds c subcommand
     4   COMPREPLY=()
     6   # Load the list of commands
     7   cmds=`"${COMP_WORDS[0]}" mach-commands`
     9   # Look for the subcommand.
    10   cur="${COMP_WORDS[COMP_CWORD]}"
    11   subcommand=""
    12   c=1
    13   while [ $c -lt $COMP_CWORD ]; do
    14     word="${COMP_WORDS[c]}"
    15     for cmd in $cmds; do
    16       if [ "$cmd" = "$word" ]; then
    17         subcommand="$word"
    18       fi
    19     done
    20     c=$((++c))
    21   done
    23   if [[ "$subcommand" == "help" || -z "$subcommand" ]]; then
    24       COMPREPLY=( $(compgen -W "$cmds" -- ${cur}) )
    25   fi
    27   return 0
    28 }
    29 complete -o default -F _mach mach

mercurial