Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] improve surfraw subcommands list
- X-seq: zsh-users 26557
- From: Marc Chantreux <eiro@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: [PATCH] improve surfraw subcommands list
- Date: Sat, 27 Feb 2021 16:27:35 +0100
- Archived-at: <https://zsh.org/users/26557>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-02/YDpk58wVLfg8EpHF%40prometheus.u-strasbg.fr>
- Dkim-filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org 316F0FF08
- List-id: <zsh-users.zsh.org>
hello people,
i wrote this patch for the _surfraw completion, it
* add bookmarks support
* remove the header from the final list
i don't know if it's good enough to be merged but
bookmark support is very useful so this is my proposal.
any review will be warmly welcome.
regards,
marc
---
Completion/Unix/Command/_surfraw | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index f945f1ca9..343d275cc 100644
--- a/Completion/Unix/Command/_surfraw
+++ b/Completion/Unix/Command/_surfraw
@@ -424,12 +424,26 @@ case $state in
yubnub)
_message -e command 'Yubnub Command'
;;
+ *)
+ _message -e string '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)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0
+ ${${(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
;;
-esac
+esac
return ret
Messages sorted by:
Reverse Date,
Date,
Thread,
Author