zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Jacob Gelbman <gelbman@gmail.com>, zsh-workers@zsh.org
Subject: Re: Completion script for the ctags program
Date: Wed, 03 Mar 2021 21:40:32 +0000	[thread overview]
Message-ID: <56eca2599980f3ae785921747e036fe830e3f03d.camel@ntlworld.com> (raw)
In-Reply-To: <ED5526C0-9A3F-4F56-86AE-50D936AB5FE9@gmail.com>

On Wed, 2021-03-03 at 14:39 -0600, Jacob Gelbman wrote:
> I got a little bit hung up on one of the points, which was what to do
> about option names that can include the language such as
> —alias-<lang>, —extras-<lang>, —fields-<lang>, —input-encoding-<lang>,
> and many more. If I actually added what the <lang> could be, the
> listing would be too long to read. I like it to just show the format
> of the option, just so you can see it in the listing when you press
> tab, but not overwhelm the output.

I suspect this is over the over the top, but I'll send it anyway in case
there are some hints here...

It's starting to get complicated, but you could treat the <lang> as an
argument to complete until there's a non-zero string there, then
treat -alias-blah matched from the command line as the option.  That's
significantly more work, though, well beyond just a first pass using
_arguments, but it is doable.

With the version I have (Emacs), you can generate a list by running a
function like the one below.  That would need a version guard and also
combining with the usual _call_program set up you'll see in a lot of existing
functions.  It doesn't work directly for the case you're after (though it
could complete the language for the Emacs version) because you're talking
about a different version of ctags, but it might give some ideas.

pws

_ctags_languages() {
  integer found
  local -a match mbegin mend
  ctags --help | while IFS= read -r line; do
    [[ $line = *"supported languages"* ]] && found=1
    if (( found )); then
      if [[ $line = (#b)[[:space:]]##([^[:space:]]##)* ]]; then
        print $match[1]
        found=2
      elif (( found == 2 )); then
        found=0
      fi
    fi
 done
}




  reply	other threads:[~2021-03-03 21:40 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 [this message]
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
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=56eca2599980f3ae785921747e036fe830e3f03d.camel@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --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).