[Surfraw-devel] Bug#240629: Info received (was Bug#240629: surfraw: bash-completion)

Justin B Rye jbr@edlug.org.uk
Tue, 30 Mar 2004 18:00:36 +0100


--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Oops, the -quiet=yes and -quiet=no options misbehave when you try to
tab-complete past the equals sign.  I fixed the other cases and
missed this one - v2.1 attached.
-- 
JBR
Ankh kak! (Ancient Egyptian blessing)

--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=surfraw

# -*- sh -*- bash programmable completion for Surfraw, v2.1
_surfraw() 
{       COMPREPLY=()
	local cur=${COMP_WORDS[COMP_CWORD]}
	local prev=${COMP_WORDS[COMP_CWORD-1]}
	local opts='-browser= -elvi -escape-url-args -graphical \
		-help -p0rn -q -quote -quiet -text -version'
	local elvi="$(cut -f1 /etc/surfraw.bookmarks ~/.surfraw.bookmarks 2>&-
			ls /usr/lib/surfraw 2>&-)"
	if      [[ $cur == -* ]]
	then    COMPREPLY=( $( compgen -W "$opts" -- $cur ) )
	# I can't see a way to get the =yes/=no parts to work...
	elif    [ "$COMP_CWORD" -eq 1 ]
	then    COMPREPLY=( $( compgen -W "$elvi" -- $cur ) )
		# "sr g<tab>" for google
	elif    [[ $prev == @(alioth|deb@(bug|content|package)s|freshmeat|sourceforge) ]]
	then    COMPREPLY=( $(apt-cache --generate pkgnames $cur) )
		# "sr debbugs 4<tab>" to check 44bsd-rdist bugs...
	elif    test -x /usr/bin/look # in bsdmainutils, "important"
	then	COMPREPLY=( $(/usr/bin/look ${cur:-''}) )
		# "sr l<tab> vy<tab>" to find the German for "vying"
	else	COMPREPLY=( $( compgen -o default -- $cur) ) # copout
	fi
	return 0
}
complete -F _surfraw surfraw sr

--n8g4imXOkfNTN/H1--