Re: [PATCH/RFC] bash: add --word-diff option to diff auto-completion

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

 



Hi,


On Tue, Sep 13, 2011 at 02:14:48PM -0500, Jonathan Nieder wrote:
> From: Rodrigo Rosenfeld Rosas <rr.rosas@xxxxxxxxx>
> Date: Tue, 13 Sep 2011 15:24:38 -0300
> 
> Add "--word-diff" to diff completion, since this is a common
> desired option when looking at diffs.
> 
> Signed-off-by: Rodrigo Rosenfeld Rosas <rr.rosas@xxxxxxxxx>
> ---
> Hi Gábor,
> 
> Here's a patch.  What do you think?

Looks obviously good to me, ...

> I was thinking it would be nice to complete --word-diff-regex, too,
> and to be able to do
> 
> 	git diff --color-words=<TAB>
> 	git diff --word-diff=<TAB>

... but yeah, there is room for while-at-its ;)

The completion script currently only offers --color-words but not
--color-words=.  This is sort of OK, because --color-words' parameters
are optional.  However, in several cases the completion script offers
both --option and --option= to indicate that it takes an optional
parameter, see e.g.

  diff --dirstat --dirstat-by-file
  commit --untracked-files
  format-patch --thread
  init --shared
  log --decorate

(But we don't do this in all such cases, see e.g. diff --stat --color
or log --branches --tags --remotes.)

So I think it's fine to offer both --color-words and --color-words=,
and both --word-diff and --word-diff=.

> but I couldn't find any examples of the latter to crib from

I'm not sure what you mean by git diff --color-words=<TAB>, because it
takes a regexp.  Or is it just too late here and I'm missing something
obvious?

Completing the mode for --word-diff=<TAB> is a good idea, but c'mon,
there are plenty of examples ;)  Have a look at _git_am(),
_git_format_patch(), or _git_init() for something easy, and
_git_commit(), _git_log(), or _git_notes() for something fancy.

Note that --word-diff= is also valid for log and shortlog, so the same
can be done there, too.


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]