From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25123 invoked by alias); 15 Oct 2017 21:00:45 -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: 41906 Received: (qmail 24326 invoked by uid 1010); 15 Oct 2017 21:00:45 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net 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(205.235.26.22):SA:0(-1.7/5.0):. Processed in 1.840865 secs); 15 Oct 2017 21:00:45 -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.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RP_MATCHES_RCVD,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=l77x=BO=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1508101227; bh=RoxQOUOmLMarbjv8QfS4cI2tBwtZE3g8Aogv3loRAkk=; h=From:References:To:Subject:Date:From:Subject; b=Nt2Xe2sXj/eoEWl27Z3ADLmXVvKIdLM94EuhfIAynUMZFjH+I/ASwuX4qRTbkDuZmi8mAaBjO2HjJGDoXnjqrqdcJCTufrrqe638GmzpfsfsTgEo8yreXigF1IP2hhjy5zY4gbtfg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cNVeCAbHkgT4RoBwo3bz8rFCkinGW5CP3B baLQbV28l0VEw.1c3Fi.3CuVk51EpEaN82ZgyJSo0HX3QwK7Bx3.YTqYdE2z xZSBel7E0eymdaQ0Zx5apYjalXwvUmgEa08Z9S4cjr6nVhG4_6ZzOLDuayBX dmX4501WVmgdUsXnZ_1nB23Em9R1ZyGF1vhFGj4nJ.jMo_Euggqu9mVU3OYh Y.JbcD18UHpSiArO6S0ypoDzuecQGOvkotmb1BWoZEKmIgqhaenJd3HL.RA- - X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <20171015185931.ano4dq3c5tevu5jf@andrew.cmu.edu> From: Oliver Kiddle References: <20171015185931.ano4dq3c5tevu5jf@andrew.cmu.edu> To: gi1242+zsh@gmail.com, zsh-workers@zsh.org Subject: Re: [patch] Completion for _deborphan and _xrandr MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3911.1508101224.1@thecus.kiddle.eu> Date: Sun, 15 Oct 2017 23:00:24 +0200 Message-ID: <3912.1508101224@thecus.kiddle.eu> gi1242+zsh@gmail.com wrote: > > I wrote a rudimentary completion script for deborphan (which probably > belongs with the Debian completion commands). Thanks for this. > I also fixed the xrandr completion to separate outputs into two groups > (connected and disconnected). Patch, and whole file attached. If there Is it useful to complete a disconnected output then? If it's only relevant with some options then we could have separate states for completing all vs. only connected outputs. > is a preferred way to submit this (e.g. by forking a git repository) let > me know and I would be happy to do so. The preferred way to submit this is by posting a patch, exactly as you have done. I've got a couple of minor comments and suggestions on the function: > + _alternative \ > + 'connected:connected outputs:('${(j: :)${(uo)${(M)xrandr_output:#* connected*}%% *}}')' \ > + 'disconnected:disconnected outputs:('${(j: :)${(uo)${(M)xrandr_output:#* disconnected*}%% *}}')' \ > + && return 0 The normal convention is for the group descriptions to be singular: they describe what comes on the command line rather than the matches collectively. So, "connected output" rather than "connected outputs". > local keep=/var/lib/deborphan/keep > _arguments : \ > {--help,-h}'[help]' \ > {--status-file,-f}'[statusfile]:file:_files' \ The description here is rather terse. > {--exclude,-e}'[work as if packages in LIST were not installed]:LIST:' \ I'm guessing that LIST here has come from the --help output. The description's inclusion of "LIST" makes less sense without corresponding text saying something like [ --exclude LIST ]. The word "specify" is often used when rewording these. Also, is it not perhaps valid to complete a list of installed packages here. So: {--exclude,-e}'[work as if specified packages were not installed]:package:_sequence _deb_packages - installed' \ That is assuming a comma-separated list. If deborphan allows you to pass -e pkg1 -e pkg2 Then you need to prefix the _arguments spec with a *: \*{--exclude,-e}'[.... > {--force-hold,-H}'[Ignore hold flags.]' \ This description is inconsistent with the earlier ones. Our normal convention is to neither capitalise the first word nor finish with a full stop. > {--priority,-p}'[PRIOR Select only packages with priority >= PRIOR.]:PRIOR:' \ The same comment I made about LIST applies here and in some later places. Is there a default priority. It can be good to provide hints, perhaps: :priority (1-100) [50]' I'm assuming the priorities are just numbers. > {--del-keep,-R}"[PKGS.. Remove PKGS from the 'keep' file.]:*:package:_values package $(< $keep)" \ Is _values really needed here or would compadd do the job? I'd also be inclined to try to avoid it dumping error messages to the terminal if the $keep file doesn't exist. Perhaps: keep=( /var/lib/deborphan/keep(N) /dev/null) .. compadd $(<$keep[1]}) Thanks again. Oliver