zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: GH:zsh-users/zsh-completions.
Date: Mon, 16 Oct 2017 20:04:05 +0000	[thread overview]
Message-ID: <1508184245.309779.1140756472.65F155BF@webmail.messagingengine.com> (raw)
In-Reply-To: <20171016161151.6981579c@pwslap01u.europe.root.pri>

Peter Stephenson wrote on Mon, 16 Oct 2017 16:11 +0100:
> That seems to me the wrong way to go.  There's no absolute need for
> completions to be in the same place as the source.

I think, in the long term, completions should be generated by option
parsing libraries (getopt(3), optparse, GetOpt::Long, etc).  The way I
see it is:

- Option parsing libraries compile the --options specification --- which
  they already have --- into a format usable by the shells.  That format
  is an API exposed by the shells.

- That format could be either "autoloadable functions to be run by
  compsys" or possibly a shell-agnostic format, that bash and zsh both
  know how to parse.

- The information could be made available to the shells either as a static
  file at a well-known path (compare /usr/share/pkg-config/foo-1.pc) or
  as the dynamic output of a standardly-named "foo --parseable-help"
  flag.  The former has the advantage that it's automatically
  detectable; the latter would require <handwave/> for the shells to
  know that a particular command supports that flag.  (to avoid the
  "`hostname --help` on solaris" thing)

Then completions would be automatically up to date, but on the flip side
it'd be harder to implement a sweeping change across all completions in
the world: we'd have to collaborate with the various option parsing
libraries on getting new compsys features exercised.  (And with bash
too, if the interchange format is shell-agnostic)

That's my blue sky.  It won't eliminate all code in Completions/ ---
functions such as _git would still have a reason to exist --- but it'd
eliminate the tedious work of copying --help output, downcasing the
first letter of every line, and doing that again after a new release of
the program being completed.

Sorry for the brain dump.

Daniel


  parent reply	other threads:[~2017-10-16 20:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7240.1507973844@thecus.kiddle.eu>
2017-10-14 14:44 ` GH:zsh-users/zsh-completions Julien Nicoulaud
2017-10-14 16:49   ` GH:zsh-users/zsh-completions Eric Cook
2017-10-16 14:29   ` GH:zsh-users/zsh-completions Oliver Kiddle
2017-10-16 15:11     ` GH:zsh-users/zsh-completions Peter Stephenson
2017-10-16 15:24       ` GH:zsh-users/zsh-completions Bart Schaefer
2017-10-16 15:42         ` GH:zsh-users/zsh-completions Peter Stephenson
2017-10-16 17:49           ` GH:zsh-users/zsh-completions gi1242+zsh
2017-10-17 21:09             ` GH:zsh-users/zsh-completions Joey Pabalinas
2017-10-18 16:23               ` GH:zsh-users/zsh-completions Oliver Kiddle
2017-10-19  1:09                 ` GH:zsh-users/zsh-completions Bart Schaefer
2017-10-19  4:03                   ` GH:zsh-users/zsh-completions Aaron Schrab
2017-10-19  5:24                     ` GH:zsh-users/zsh-completions Bart Schaefer
2017-11-01 23:33                   ` ChangeLogs (Re: GH:zsh-users/zsh-completions.) Oliver Kiddle
2017-11-01 23:46                     ` Bart Schaefer
2017-11-02 20:09                       ` Oliver Kiddle
2017-10-19  1:31                 ` GH:zsh-users/zsh-completions Joey Pabalinas
2017-10-19 14:37                 ` GH:zsh-users/zsh-completions Daniel Shahaf
2017-10-30 23:38                   ` GH:zsh-users/zsh-completions Oliver Kiddle
2017-11-01 16:35                     ` GH:zsh-users/zsh-completions Daniel Shahaf
2017-11-01 22:58                       ` GH:zsh-users/zsh-completions Oliver Kiddle
2017-10-16 23:00           ` GH:zsh-users/zsh-completions Bart Schaefer
2017-10-16 20:04       ` Daniel Shahaf [this message]
2017-10-17  7:53       ` GH:zsh-users/zsh-completions Oliver Kiddle
2017-10-17  8:41         ` GH:zsh-users/zsh-completions Peter Stephenson
2017-10-16 15:26     ` GH:zsh-users/zsh-completions gi1242+zsh
2017-10-17  9:35       ` GH:zsh-users/zsh-completions Oliver Kiddle
2017-10-19 18:25         ` GH:zsh-users/zsh-completions Daniel Tameling

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=1508184245.309779.1140756472.65F155BF@webmail.messagingengine.com \
    --to=d.s@daniel.shahaf.name \
    --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).