From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11115 invoked from network); 11 Mar 2021 18:09:37 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Mar 2021 18:09:37 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1615486177; b=rTnn/zlXHO4vmfJkbFoG1x06eHaG70d2NqH++hwE6nF400m/0lg/LlmQkYr0RWt2+PX3xVa1Z8 W962YKO62DqwvELJ1eZtPmDdnDotkwdLHDNi66Rm7HJY9OufwJhU/0CpSa46AFpqaC8U4c52rf dXTcYFWrlnpI1BccazsY8x+FuR9X3QTyRuPDYNhYnar7rrXTx0HWwAVp28Y0z3ZYtbt0DWEEKe DpbwQtsRK3UirbzYe3JNI41Y1bAbI9lRNwCl+A99ghw9WrbqBQXLSyBHiZPkpK+J8yG2IZqhXl CFItRR8zpssKYkw1DqpbYRd4+ViNw05n38qcyFHK4PNZmw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (aurora-borealis.phear.org) smtp.remote-ip=188.42.45.194; dkim=pass header.d=phear.org header.s=20180217 header.a=rsa-sha256; dmarc=none header.from=phear.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1615486177; bh=ccADov4VSabb4JcTeQa6r8BcQ5qIRU7ZQGXtrJxHlKU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature; b=X4gSvPx8DD8BLcxF4b59M/yUjyxic+J6K+jgMFaEl5JSd7J1VBQz4LqEffK5cYdcfW88Mw/tiv PJl64wolNIQpjyuoGE5NdwVDQoNZMayPT5M6AOz3uMKUi4qE/YZbpHPUqkZKCwr2+1U8i574sj ENXJSOHbac8nm4eJT6pvEOwY27qjSSXt2+Ab59YVaSs3sMuod/A6z69Bx6QEbwuHFVnL9gDE4L 2LBgN/wfX8t+Sm1rgAzzmM7GHlFnGvYVlNvBxap4GtaLqVxrCwHyslegXxyNJVh6tVs40BrxWG RWSaGSjyVjUBAGwAzwGbCVkpzka5jcWTAXjH761P7mP/tw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=Rttqa3ILf1bZY9Uyr2KbhazszlEMOVDPDbvJegTS4+4=; b=vJ/H7/+sSYO0sR4Ogcn6KhC4U6 4z8uIGYq9HNUo9v2izIKK0pqPJMIPIlTufRXqt2DB6rg6KDU5JJ+VYzANmOU+YAUTPEWoeyANzk62 hN9uKgRu1L0eydWFmuvCjDfzL9uG0Tf3c2oCvjfhVkvGmBCgcbtIl5kacqvw26zS/BL2HwNeaOa9d Gq7rWyPh/2vRVYpFyZC3oeRWmbMoV1/X3qt3q2kRAHuM+6oo8gA1VT7DpcXvsLKg85ctDRmMiRjfw zsZED2os0yIx9YBlrv8vzJ/wNBO8eu+54um19I6zf54Lo+bXIjI9rGaTEjsBTMWqNsg48mjiiVqmG 8E5lfwSw==; Received: from authenticated user by zero.zsh.org with local id 1lKPke-000LTe-QG; Thu, 11 Mar 2021 18:09:36 +0000 Authentication-Results: zsh.org; iprev=pass (aurora-borealis.phear.org) smtp.remote-ip=188.42.45.194; dkim=pass header.d=phear.org header.s=20180217 header.a=rsa-sha256; dmarc=none header.from=phear.org; arc=none Received: from aurora-borealis.phear.org ([188.42.45.194]:52870) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lKPk6-000L6N-Jn; Thu, 11 Mar 2021 18:09:03 +0000 Received: from localhost (unknown [127.0.0.1]) by aurora-borealis.phear.org (Postfix) with ESMTP id A2F88FF34; Thu, 11 Mar 2021 18:09:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at phear.org Received: from aurora-borealis.phear.org ([127.0.0.1]) by localhost (mail.phear.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AeUaKKPB9W2B; Thu, 11 Mar 2021 18:08:59 +0000 (UTC) Received: from prometheus.u-strasbg.fr (82-65-50-238.subs.proxad.net [82.65.50.238]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: khatar) by aurora-borealis.phear.org (Postfix) with ESMTPSA id E2205FF33; Thu, 11 Mar 2021 18:08:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org E2205FF33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1615486139; bh=ccADov4VSabb4JcTeQa6r8BcQ5qIRU7ZQGXtrJxHlKU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TQ7UrfdRSVuf2pRFx7JBu1oZYyrHxBneS3NosevWtcBFYHu9qwUJaTw/uE3CipqfJ fzSInaEk4koeW7jDJ/lGTejRjOnW8SP7ntg299IphsYod0fV1XD8XQ5gVgC7cWUFAA /I/xWK9i8UMYzZxhPMf1dTq9E4bnkQiobo1FmrXNj1ravvUISfPu3KFTsr6O8zdinn AJtKgbH5hQJQcxGdOybENaq1UkB7LLe27uWvsAkpnNaf2aUGeGDFGLegLONDGdD/0P JyL5FF8EBpNBWsg9/zuWRd/k3AH/JiGuPY6FS66X8Ea2/GGSz9n/jCx5+u8iOfqtnt W3P7k1YnkooTg== Date: Thu, 11 Mar 2021 19:08:57 +0100 From: Marc Chantreux To: Daniel Shahaf Cc: Zsh Users Subject: Re: [PATCH] improve surfraw subcommands list Message-ID: References: <20210301152344.GA18578@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210301152344.GA18578@tarpaulin.shahaf.local2> X-Seq: 26579 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: hello, Daniel: thanks for the review. this is the new patch proposal. > > + local -UT XDG_CONFIG_DIRS xcd > Don't play golf. Name it «xdg_config_dirs». done > > + # 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? the comment is now more clear about it. > > - ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0 > > + ${${(f)"$(surfraw -elvi)"}%%[[:space:]]*} $( > Restore _call_program. done > > + 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. done. > > + ${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. I removed it. So the new patch is below. thanks again. regards marc diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw index f945f1ca9..4838f1e58 100644 --- a/Completion/Unix/Command/_surfraw +++ b/Completion/Unix/Command/_surfraw @@ -424,12 +424,30 @@ case $state in yubnub) _message -e command 'Yubnub Command' ;; + *) + _message -e string '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 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 +esac return ret