From 7518b20a01bd27a9246d9b040ba5f972ab686e62 Mon Sep 17 00:00:00 2001 From: Marc Chantreux Date: Sat, 27 Feb 2021 16:27:35 +0100 Subject: users/26557: add bookmarks support and remove the header from the final list in surfraw completion --- ChangeLog | 5 +++++ Completion/Unix/Command/_surfraw | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83bd3c3a7..204a71296 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-03-31 Oliver Kiddle + + * Marc Chantreux: users/26557: Completion/Unix/Command/_surfraw: + add bookmarks support and remove the header from the final list + 2021-03-29 Aleksandr Mezin * 47561 (the git and cvs parts) (compare 44919 + 44920): 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 -- cgit 1.4.1