Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] improve surfraw subcommands list
- X-seq: zsh-users 26559
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Marc Chantreux <eiro@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: [PATCH] improve surfraw subcommands list
- Date: Mon, 1 Mar 2021 15:23:44 +0000
- Archived-at: <https://zsh.org/users/26559>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-03/20210301152344.GA18578%40tarpaulin.shahaf.local2>
- In-reply-to: <YDpk58wVLfg8EpHF@prometheus.u-strasbg.fr>
- List-id: <zsh-users.zsh.org>
- References: <YDpk58wVLfg8EpHF@prometheus.u-strasbg.fr>
Marc Chantreux wrote on Sat, Feb 27, 2021 at 16:27:35 +0100:
> 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
Don't play golf. Name it «xdg_config_dirs».
> + # as it starts with a space, the header becomes an empty
> + # string removed by the list expansion
What? Does "the header" mean the first line of the output?
> _wanted elvi expl elvi compadd \
> - ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0
> + ${${(f)"$(surfraw -elvi)"}%%[[:space:]]*} $(
Restore _call_program.
> + # extract the keys of all bookmarks (should be in surfraw itself)
> + awk '{keys[$1]=1} END {for (k in keys) print k}' \
Use a parameter expansion rather than an external dependency and a fork,
if possible. If there's a reason to make an exception, it's not clear
to me.
> + $^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)
There shouldn't be an error message here at all, certainly not such
a brief one.
>
Please use proper capitalization in your written English.
> + ) && ret=0
> ;;
> -esac
> +esac
>
> return ret
Messages sorted by:
Reverse Date,
Date,
Thread,
Author