Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (24 sloc) 0.918 kB
#!/bin/bash
_cower() {
local ng cower_exec cur prev opts src ng
# nullglob avoids problems when no results are found
[[ ! -o nullglob ]] && { shopt -s nullglob; ng=1; }
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
cower_exec=$(type -P cower)
[[ -z $cower_exec ]] && return 0
opts="-d --download -i --info -s --search -u --update -c --color \
-f --force -q --quiet -t --target -v --verbose"
# complete options
if [[ $cur == -* ]]; then
COMPREPLY=( $(compgen -W "$opts" -- $cur ) )
elif [[ $cur == --target= || $prev == '-t' ]]; then
COMPREPLY=( $(compgen -f -- $cur) )
elif [[ ${COMP_WORDS[@]} = *-@(!(-*)[di]*|-download|-info)* ]]; then
COMPREPLY=( $(compgen -W "$([[ ${#cur} -ge 2 ]] && $cower_exec -sq -- $cur 2>/dev/null)" -- $cur ) )
fi
# restore nullglob setting
[[ $ng ]] && shopt -u nullglob
}
complete -F _cower cower
Jump to Line
Something went wrong with that request. Please try again.