|
|
# -*- sh -*- bash programmable completion for Surfraw, v2.2 | # -*- sh -*- bash programmable completion for Surfraw, v2.2 |
|
_srpkgname() |
|
{ |
|
local pd |
|
local dir=$(sed -n -e '/^PORTDIR=/ { s/^[^=]\+="\?\([^"]\+\|\S\+\).*/\1/p ; q }' \ |
|
/etc/make.{conf,globals})/* |
|
local cur="$1" |
|
|
|
COMPREPLY=($(compgen -W "$( |
|
for pd in $dir |
|
do |
|
[ ! -d ${pd} ] && continue |
|
builtin cd ${pd} |
|
echo * |
|
done)" -- ${cur}) |
|
) |
|
} |
_surfraw() | _surfraw() |
{ COMPREPLY=() | { COMPREPLY=() |
local cur=${COMP_WORDS[COMP_CWORD]} | local cur=${COMP_WORDS[COMP_CWORD]} |
|
|
then COMPREPLY=( $( compgen -W "$elvi" -- $cur ) ) | then COMPREPLY=( $( compgen -W "$elvi" -- $cur ) ) |
# "sr go<tab>" for google | # "sr go<tab>" for google |
elif [[ $prev == @(alioth|deb@(bugs|contents|packages|pts|sec)|freshmeat|fsfdir|sourceforge) ]] | elif [[ $prev == @(alioth|deb@(bugs|contents|packages|pts|sec)|freshmeat|fsfdir|sourceforge) ]] |
then COMPREPLY=( $(apt-cache --generate pkgnames $cur) ) |
then _srpkgname ${cur} |
# "sr debbugs 4<tab>" to check 44bsd-rdist bugs... | # "sr debbugs 4<tab>" to check 44bsd-rdist bugs... |
elif [[ -x /usr/bin/look ]] # in bsdmainutils, "important" | elif [[ -x /usr/bin/look ]] # in bsdmainutils, "important" |
then COMPREPLY=( $(/usr/bin/look ${cur:-''}) ) | then COMPREPLY=( $(/usr/bin/look ${cur:-''}) ) |