Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
2 new patches for _surfraw
- X-seq: zsh-workers 48445
- From: Marc Chantreux <eiro@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: 2 new patches for _surfraw
- Date: Fri, 9 Apr 2021 21:49:52 +0200
- Archived-at: <https://zsh.org/workers/48445>
- Dkim-filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org BC704FF32
- List-id: <zsh-workers.zsh.org>
hello people,
here are
* one comply to good practices
* one bugfix
any review is warmly welcome.
regards,
marc
From d6acd1c9bb02d77d5102f7319c327e9aec702e2f Mon Sep 17 00:00:00 2001
From: Marc Chantreux <eiro@xxxxxxxxx>
Date: Fri, 9 Apr 2021 21:44:54 +0200
Subject: [PATCH 1/2] pluralize tags in _surfraw
---
Completion/Unix/Command/_surfraw | 44 +++++++++++++++++---------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index 343d275cc..09852475e 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"'
+ '*:strings:_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 \
@@ -164,7 +164,7 @@ 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 \
@@ -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)
@@ -422,27 +422,31 @@ 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 string 'search string'
+ _message -e strings 'search string'
;;
esac
;;
elvi)
- local -UT XDG_CONFIG_DIRS xcd
- # as it starts with a space, the header becomes an empty
- # string removed by the list expansion
- _wanted elvi expl elvi compadd \
- ${${(f)"$(surfraw -elvi)"}%%[[:space:]]*} $(
- # extract the keys of all bookmarks (should be in surfraw itself)
- awk '{keys[$1]=1} END {for (k in keys) print k}' \
- $^xcd/surfraw/bookmarks(Nr) \
- /etc/xdg/surfraw/bookmarks(Nr) \
- /etc/surfraw.bookmarks(Nr) \
- ${XDG_CONFIG_HOME-${HOME?homeless}/.config}/surfraw/bookmarks(Nr) \
- ${HOME?homeless}/.surfraw.bookmarks(Nr)
- ) && 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 an 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
--
2.30.2
From 210a35e9512d3add59774c3012c4ebc241411e55 Mon Sep 17 00:00:00 2001
From: Marc Chantreux <eiro@xxxxxxxxx>
Date: Fri, 9 Apr 2021 21:45:40 +0200
Subject: [PATCH 2/2] fix ebay completion bug due to tailing space
also removing all the other extra spaces
---
Completion/Unix/Command/_surfraw | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index 09852475e..81f8d635f 100644
--- a/Completion/Unix/Command/_surfraw
+++ b/Completion/Unix/Command/_surfraw
@@ -165,7 +165,7 @@ case $state in
;;
debsec)
_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)
@@ -233,7 +233,7 @@ case $state in
'-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
--
2.30.2
Messages sorted by:
Reverse Date,
Date,
Thread,
Author