summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_surfraw
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_surfraw')
-rw-r--r--Completion/Unix/Command/_surfraw94
1 files changed, 56 insertions, 38 deletions
diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index f945f1ca9..d153cd493 100644
--- a/Completion/Unix/Command/_surfraw
+++ b/Completion/Unix/Command/_surfraw
@@ -20,11 +20,11 @@ case $state in
subcmd)
args=(
'-help[display help information]'
- '*:string:_guard "^-*" "search string"'
+ '*: :_guard "^-*" "search string"'
)
case "$words[1]" in
ask|cia|cnn|deblogs|excite|filesearching|foldoc|happypenguin|slashdot|slinuxdoc|sundocs|sunsolve|xxx)
- _message -e string 'search string'
+ _message -e strings 'search string'
;;
alioth)
_arguments $args \
@@ -64,10 +64,10 @@ case $state in
'*:search string' && ret=0
;;
ctan)
- _arguments $args \
- '-name[search by filename]' \
- '-desc[search descriptions (default)]'\
- '-doc[search documentation]'
+ _arguments $args \
+ '-name[search by filename]' \
+ '-desc[search descriptions (default)]'\
+ '-doc[search documentation]'
;;
currency)
_arguments \
@@ -164,8 +164,8 @@ case $state in
'-doc[view PTS documentation]' && ret=0
;;
debsec)
- _message -e string 'package name, bug number or CVE ID'
- ;;
+ _message -e strings 'package name, bug number or CVE ID'
+ ;;
deja)
_arguments $args \
'-results=-:[number of results to return]' \
@@ -183,7 +183,7 @@ case $state in
;;
ebay)
_arguments $args \
- '-country=-:country:(com de uk fr)' \
+ '-country=-:country:(com de uk fr)' \
'-results=-:[number of results to return]:number' && ret=0
;;
etym)
@@ -220,7 +220,7 @@ case $state in
_deb_packages avail && ret=0
;;
fsfdir)
- _arguments $args
+ _arguments $args
;;
google)
_arguments $args \
@@ -229,19 +229,19 @@ case $state in
'-search=-:topic:(bsd linux mac unclesam)' && ret=0
;;
gutenberg)
- _arguments $args \
- '-title[search titles (default)]'
- '-author[search authors]'
- '-num[search etext numbers]'
- ;;
+ _arguments $args \
+ '-title[search titles (default)]'
+ '-author[search authors]'
+ '-num[search etext numbers]'
+ ;;
imdb)
_arguments $args \
'-category=-:category:(All Titles MyMovies People Characters Quotes Bios Plots)' && ret=0
;;
ixquick)
- _arguments $args \
- '-search=-:search type:(web pics)' \
- '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)'
+ _arguments $args \
+ '-search=-:search type:(web pics)' \
+ '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)'
;;
jake)
_arguments $args \
@@ -261,9 +261,9 @@ case $state in
'-head=:display headlines:(on off)' \
'-grid=:show results in grid:(on off)' \
'-spell=:spelling tolerance:(off standard force)' \
- '*:dictionary word:->dictword' && ret=0
+ '*:dictionary word:->words' && ret=0
- [[ "$state" = dictword ]] && _wanted words expl 'dictionary word' \
+ [[ "$state" = words ]] && _wanted words expl 'dictionary word' \
compadd $(look "${PREFIX}") && ret=0
;;
netbsd|openbsd)
@@ -386,20 +386,20 @@ case $state in
:URL:_urls && ret=0
;;
wayback)
- _arguments $args \
- '-syear=-[start search from this year]:year' \
- '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
- '-sday=-[start search from this day]:number' \
- '-eyear=-[end search in this year]:year' \
- '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
- '-eday=-[end search in this day]:number' \
- '-list[list all pages that match search criteria]' \
- '-dups[show dups]' \
- '-compare[compare pages]' \
- '-pdf[show as PDF]' \
- '-alias=-[how to handle site aliases]:alias:(merge show hide)' \
- '-redir=-[how to handle redirections]:redir:(hide flag show)' \
- '-type=-[file type to search for]:type:(image audio video binary text pdf)'
+ _arguments $args \
+ '-syear=-[start search from this year]:year' \
+ '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
+ '-sday=-[start search from this day]:number' \
+ '-eyear=-[end search in this year]:year' \
+ '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
+ '-eday=-[end search in this day]:number' \
+ '-list[list all pages that match search criteria]' \
+ '-dups[show dups]' \
+ '-compare[compare pages]' \
+ '-pdf[show as PDF]' \
+ '-alias=-[how to handle site aliases]:alias:(merge show hide)' \
+ '-redir=-[how to handle redirections]:redir:(hide flag show)' \
+ '-type=-[file type to search for]:type:(image audio video binary text pdf)'
;;
wetandwild)
_arguments \
@@ -422,14 +422,32 @@ case $state in
'-results=-[specify number of results to return]:number' && ret=0
;;
yubnub)
- _message -e command 'Yubnub Command'
+ _message -e commands 'Yubnub Command'
+ ;;
+ *)
+ _message -e strings 'search string'
;;
esac
;;
elvi)
- _wanted elvi expl elvi compadd \
- ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0
+ local -UT XDG_CONFIG_DIRS xdg_config_dirs
+ local it
+ # list the applets
+ set -- ${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##-- *}
+ shift # the first line is a header: remove it
+ # then list the bookmarks
+ for it in \
+ $^xdg_config_dirs/surfraw/bookmarks(Nr) \
+ /etc/xdg/surfraw/bookmarks(Nr) \
+ /etc/surfraw.bookmarks(Nr) \
+ ${XDG_CONFIG_HOME-$HOME/.config}/surfraw/bookmarks(Nr) \
+ $HOME/.surfraw.bookmarks(Nr)
+ do
+ read -d'\0' it < $it
+ set -- "$@" ${${(f)it}%%[[:space:]]*}
+ done
+ _wanted elvi expl elvi compadd "$@" && ret=0
;;
-esac
+esac
return ret