Re: [PATCH 2/2] completion: Use parse-options raw output for simple long options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stephen,

On Wed, Apr 11, 2012 at 03:29:25AM -0700, Stephen Boyd wrote:
> Now that parse-options supports generating lists of long options for any
> parse-optified git program we can remove the hand-coded lists in the
> completion script. Replace these lists with code to generate the lists
> lazily when a user tab completes that specific command.

> +__git_list_command_options ()
> +{
> +	git $@ --dump-raw-long-options
> +}

Attempting option completion for the first time for commands requiring
a repository to work (e.g. 'add', 'branch', 'checkout', etc.) outside
of a git repository produces a 'fatal: not a git repository' error.
These commands require a repository for '--dump-raw-long-options',
too, otherwise they error out in __git_list_command_options().  So at
least we'll need

  git $@ --dump-raw-long-options 2> /dev/null

to silence that error, but even then the user won't get any options.
Now, I don't think that getting a list of options is that useful at
that point, because the command will error out anyway (except when the
user explicitly specifies the paths to the repo and work tree), but
it's a side effect nonetheless, because it worked before.

Computing the long options for commands not requiring a repository
(e.g. 'clone', 'archive', 'help', etc.) works properly even for the
first time and outside of a repository.


Best,
Gábor

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]