zsh-workers
 help / color / mirror / code / Atom feed
From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: "Jacob Gelbman" <gelbman@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: Completion script for the ctags program
Date: Sun, 07 Mar 2021 22:10:56 +0000	[thread overview]
Message-ID: <7f0a752e-2685-4c4b-8a31-b8db1728af1f@www.fastmail.com> (raw)
In-Reply-To: <F53E3965-6A3F-4FCC-B29E-231EC9DFAF8C@gmail.com>

Jacob Gelbman wrote on Sun, 07 Mar 2021 21:57 +00:00:
> 
> 
> > On Mar 7, 2021, at 3:42 PM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > 
> > Thanks for the revision.  Not a full review; just two points:
> > 
> > Jacob Gelbman wrote on Sun, 07 Mar 2021 19:18 +00:00:
> >>> On Feb 24, 2021, at 8:24 AM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> >>> Jacob Gelbman wrote on Wed, Feb 24, 2021 at 01:20:24 -0600:
> >>>>   "--fields=[include selected extension fields (flags afmikKlnsStz)]:flags"
> >>> 
> >>> Recommend to move the afmikKlnsStz thing to after the colon, so it'll be
> >>> shown at a more appropriate point.  Also, it would be helpful to display
> >>> descriptions to the flags using, e.g., «compset» (for the leading plus
> >>> sign) followed by «_values -s ''».
> >> 
> >> I moved the possible values to the argument description, but I don’t 
> >> have enough time to figure out how to complete them automatically right 
> >> now.
> > 
> > Like this:
> > 
> > _f() { _arguments : '--foo:bar: _values -s "" baz "a[access]" "f[file]" "i[inheritance]"' }
> 
> Right, I can do that. I wasn’t sure if the extra + and - symbols would 
> make it complicated.

Oh, sorry.  I forgot about those.  In that case, something like this:

_f() { _arguments : '--foo:bar:_g' }
_g() { compset -P '[-+]'; _values -s "" baz "a[access]" "f[file]" "i[inheritance]" }

Plus or minus some code to offer «+» and «-» when there's nothing to the
left of the cursor.

Also, I suspect --fields should be declared repeatable.

> >>>> elif [ "$state" = "languages" ]; then
> >>>>   _values -s , languages $languages
> >>> 
> >>> Don't pass unsanitized command output to a builtin.  I don't know the
> >>> fix off the top of my head.
> > 
> > This point has been neither responded to nor implemented.
> 
> I sanitize the output a little bit, by cutting just the first word from 
> the list that’s returned. That fixes lines like "OldC++ [disabled]" And 
> I’m not that worried about possibly feeding in incorrectly formatted 
> data. What’s the worst that could happen? The listing will look messed 
> up?

An option flag could be injected from an external command into compadd.
You don't know in advance what flag that would be and what it would mean
in compadd (you need to consider future compadd too), so this is
essentially undefined behaviour.


  reply	other threads:[~2021-03-07 22:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23  3:11 Jacob Gelbman
2021-02-23 10:11 ` Peter Stephenson
2021-02-23 22:20   ` Oliver Kiddle
2021-02-23 22:45     ` Bart Schaefer
2021-02-23 23:51       ` Oliver Kiddle
2021-02-24  0:52         ` Bart Schaefer
2021-02-24 13:47           ` Daniel Shahaf
2021-02-23 23:05     ` Mikael Magnusson
2021-02-23 21:39 ` Oliver Kiddle
2021-02-24  4:45   ` Jacob Gelbman
2021-02-24  7:20     ` Jacob Gelbman
2021-02-24  9:26       ` Peter Stephenson
2021-02-24 14:24       ` Daniel Shahaf
2021-02-24 18:58         ` Jacob Gelbman
2021-02-24 19:01           ` Bart Schaefer
2021-03-03 20:02         ` Daniel Shahaf
2021-03-03 20:39           ` Jacob Gelbman
2021-03-03 21:40             ` Peter Stephenson
2021-03-03 22:06             ` Daniel Shahaf
2021-03-03 22:08           ` Jacob Gelbman
2021-03-03 23:28             ` Aaron Schrab
2021-03-03 23:43               ` Daniel Shahaf
2021-03-03 23:35             ` Daniel Shahaf
2021-03-07 19:18         ` Jacob Gelbman
2021-03-07 21:42           ` Daniel Shahaf
2021-03-07 21:57             ` Jacob Gelbman
2021-03-07 22:10               ` Daniel Shahaf [this message]
2021-03-11 16:15                 ` Daniel Shahaf
2021-03-11 17:08                   ` Jacob Gelbman
2021-03-20  1:43                     ` Lawrence Velázquez
2021-03-27 16:14                       ` Lawrence Velázquez
2021-03-27 20:43                         ` Daniel Shahaf
2021-03-28 23:29                     ` Oliver Kiddle
2021-03-29  8:54                       ` Peter Stephenson
2021-03-29 15:07                         ` EOL normalization? (Was: Completion script for the ctags program) Lawrence Velázquez
2021-03-29 15:34                           ` Daniel Shahaf
2021-03-29 15:41                             ` Lawrence Velázquez
2021-02-24 21:54       ` Completion script for the ctags program dana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f0a752e-2685-4c4b-8a31-b8db1728af1f@www.fastmail.com \
    --to=d.s@daniel.shahaf.name \
    --cc=gelbman@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).