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,


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. Unforunately,
> doing lazy evalution takes more lines than before, but the benefit is we
> reduce the amount of trivial patches to update the script for new and/or
> removed options. It also mildly encourages the migration of git commands
> to the parse-options API.
> 
> Signed-off-by: Stephen Boyd <bebarino@xxxxxxxxx>
> ---
> 
> Is there some way to compute these lists with some magical function instead
> of duplicating that logic over and over?

Maybe a function like this:

__git_compute_command_options ()
{
        local varname="__git_${@//[ -]/_}_options"
        eval "test -n \"\$$varname\" || $varname=\"$(git $@ --dump-raw-long-options)\""
}

And then in each completion function just need to call this function
with the command (and possibly subcommand) as parameter:

__git_compute_command_options add


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]