From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14978 invoked by alias); 16 Jul 2018 17:24:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43178 Received: (qmail 10511 invoked by uid 1010); 16 Jul 2018 17:24:52 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr1-f68.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.221.68):SA:0(-1.9/5.0):. Processed in 1.088153 secs); 16 Jul 2018 17:24:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: doron.behar@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XqZM601oqEdStJQXwzAUM3YLhjg3jZ0nP1Nq2OO/Jjw=; b=jfORW1e0iQ4pl+6RxEk0Bnl3HMYmcNeE8QPmKn2T8M1R1g0WZdYrndJrjJxebMVw7u ODps3rRJxgY5gyPTydxqD4GNKqAt2PbW2BzLZW63DzHd5MHqmJrgWju1hCoE8kk6B2GQ 2CJm8r+ETgAnMORwBuTbfsSCxmZRD6KrvtCDCEurV8YDrpPQ41oTUMD12RuCEwZfO9J0 cyNB+uFB2r7jbGVDqdeNky8fG6yYy1feuBCAZAHx22HQjI1WFMRNIKmDoZ3vcQxItmPu jYoPucbxwNIRLe1PWZHY7Qv1mN+lOVhRPHOhhLfQHVFtTdQNXcZFo/1/r1u6TfOgoFrw 3iCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=XqZM601oqEdStJQXwzAUM3YLhjg3jZ0nP1Nq2OO/Jjw=; b=o0gCDpYkARn/ZGENmrcUc8BWRPzMnQLmMYTk3Lx/kZAl6V/0raPKskrBftJq6g1zDN HfUycGcdmoMI/bShA/iszH4d7CYMUYwqqBy9JFeblzNG+nvs0tHltBqy83vV8jlhvFDz uu7vw408oThuMALBXRDy9B5wLzrj/swYe/2TzAv5v4gLNfsPPOW+3FGciI0oRBGKtEHK SN8lte8Fx2Njj70141PZYxWvekP5wA/3oRT37yxGGSV7uzsi+P1lGWymBBpfKq0TtiVc w2GsP6mt7rNlK5xsYHuIKQbc5CaDXJCDfG9P7FFkqlqGXUA8tNd5Z9f6fOjccchAp3bq /EZA== X-Gm-Message-State: AOUpUlH6TVj8U/o8AXLgIH1bP1H4PM5PqiXchEpnNISxSNiwcWuyAEE2 31uGYOnfKVqYwVldU0aRFf4tnIUe X-Google-Smtp-Source: AAOMgpcTGUKtqXVyv6PUoxQzh7uLU5Iac6G4j8euJzXHjTy1mZbeBr48/tKsNAWegdGmDaszZZrNfg== X-Received: by 2002:adf:93a3:: with SMTP id 32-v6mr11688778wrp.140.1531761886917; Mon, 16 Jul 2018 10:24:46 -0700 (PDT) Date: Mon, 16 Jul 2018 20:24:30 +0300 From: Doron Behar To: zsh-workers@zsh.org, dana@dana.is Subject: Re: [PATCH] Add completion for zathura. Message-ID: <20180716172430.e7bxrcbieum5smmm@NUC.doronbehar.com> Mail-Followup-To: zsh-workers@zsh.org, dana@dana.is References: <20180713195259.8656-1-doron.behar@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180713195259.8656-1-doron.behar@gmail.com> User-Agent: NeoMutt/20180622 Hey everyone, just reminding you there's this patch waiting for a merge or a review / comment. Thanks. On Fri, Jul 13, 2018 at 10:52:59PM +0300, doron.behar@gmail.com wrote: > From: Doron Behar > > Make it aware of the plugins installed on the machine. > --- > Completion/Unix/Type/_pspdf | 2 +- > Completion/X/Command/_zathura | 48 +++++++++++++++++++++++++++++++++++ > 2 files changed, 49 insertions(+), 1 deletion(-) > create mode 100644 Completion/X/Command/_zathura > > diff --git a/Completion/Unix/Type/_pspdf b/Completion/Unix/Type/_pspdf > index 5bb8650b1..1df3f860c 100644 > --- a/Completion/Unix/Type/_pspdf > +++ b/Completion/Unix/Type/_pspdf > @@ -1,4 +1,4 @@ > -#compdef gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii ghostview mgv pstoedit pstotgif zathura > +#compdef gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii ghostview mgv pstoedit pstotgif > > local expl ext > > diff --git a/Completion/X/Command/_zathura b/Completion/X/Command/_zathura > new file mode 100644 > index 000000000..141cadf63 > --- /dev/null > +++ b/Completion/X/Command/_zathura > @@ -0,0 +1,48 @@ > +#compdef zathura > + > +(( $+functions[_zathura_files] )) || > +_zathura_files(){ > + local -a plugins_files > + local plugins_dir > + for plugins_dir in \ > + ${(Qv)opt_args[(i)-p|--plugins-dir]}(#qN) \ > + {/usr/local,/usr,}/lib/zathura(#qN) > + do > + plugins_files=( $plugins_dir/*.so ) > + (( $#plugins_files )) && break > + done > + if [[ -z "${plugins_files}" ]]; then > + _files -g "*.pdf(-.)" > + return > + fi > + local -a supported_filetypes > + local pf > + for pf in "${plugins_files[@]}"; do > + if [[ $pf =~ "mupdf" ]]; then > + supported_filetypes+="pdf" > + supported_filetypes+="epub" > + supported_filetypes+="xps" > + elif [[ $pf =~ "poppler" ]]; then > + supported_filetypes+="pdf" > + else > + supported_filetypes+="${${pf%.so}#${plugins_dir}/lib}" > + fi > + done > + _files -g "*.(${(j.|.)supported_filetypes})(-.)" > +} > + > +_arguments -s -S \ > + {-e,--reparent=}'[specify xid of window to reparent to]:xid:_x_window' \ > + {-c,--config-dir=}'[specify path to the config directory]:config directory:{_files -/}' \ > + {-d,--data-dir=}'[specify path to the data directory]:data directory:{_files -/}' \ > + {-p,--plugins-dir=}'[specify path to the directory containing plugins]:plugins directory:{_files -/}' \ > + {-w,--password=}"[specify a password for the document]:password: " \ > + {-P,--page=}'[open the document at the given page number]:page number: ' \ > + {-l,--log-level=}'[set log level]:log level:(debug info warning error)' \ > + {-x,--synctex-editor-command=}'[specify synctex editor command]:synctex editor command:_cmdstring' \ > + '--synctex-forward=[jump to the given position]:synctex position: ' \ > + '--synctex-pid=[specify pid of an instance having the correct file opened]:synctex pid:_pids' \ > + '--fork[fork into background]' \ > + '(- :)--version[display version string and exit]' \ > + '(- :)--help[display help and exit]' \ > + '*:file:_zathura_files' > -- > 2.18.0 >