Re: [PATCH v2/RFC] Make git-completion Bash 4 compatible.
- From
Peter van der Does <peter@avirtualhome.com>
- Date
- Oct 28, 2010, 18:46 UTC
- Message-ID
- <20101028144649.0f7b13b6@MonteCarlo>
- In-Reply-To
- <m31v7ai9c2.fsf@localhost.localdomain>
On Thu, 28 Oct 2010 09:15:45 -0700 (PDT) Jakub Narebski <jnareb@gmail.com> wrote:
Show 32 quoted lines
> Peter van der Does <peter@avirtualhome.com> writes: > > On Wed, 27 Oct 2010 19:54:55 -0500 > > Jonathan Nieder <jrnieder@gmail.com> wrote: > > > > > Peter van der Does wrote: > > > > > > > The bash completion script could still be included with the > > > > core, but we can offer different versions for different shells. > > > > > > Why? That's three times the maintenance work. > > > > The cons of everything in one script: > > - If the script needs an update the submitter has to take in account > > the different coding standards each shell has. Examples of this > > have been given in the commit message of 06f44c3 (completion: make > > compatible with zsh, 2010-09-06) > > > > - The script could end up with a slew of if statements to see which > > shell the script is running in and taking some action. > > > > - Shells don't share all the same functions, the script could be > > filled with functions not needed in other shells. the zsh patch > > includes one, the Bash 4 patch includes several. > > > > The pros of everything in one script: > > - Small changes, like adding an extra option to a git command for > > completion only have to implemented in one script. > > What about having separate scripts, but sourcing common library that > doesn't do completion, but just provides list of possible completions? > This would be best of both worlds, I think. >
That would be the best solution.
I believe it's very hard to accomplish though. The options for completion are determined within each completion function, and depending on the option a decision on what to offer the user is made. The way to decide which option is given and what to offer differs, some functions use for/next loops, some use case <var>.
-- Peter van der Does GPG key: E77E8E98 IRC: Ganseki on irc.freenode.net Twitter: @petervanderdoes