git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: "SZEDER Gábor" <szeder@ira.uka.de>,
	"Rodrigo Rosenfeld Rosas" <lbocseg@yahoo.com.br>,
	"Thomas Rast" <trast@student.ethz.ch>,
	git@vger.kernel.org
Subject: Re: [PATCH/RFC] bash: add --word-diff option to diff auto-completion
Date: Wed, 14 Sep 2011 01:29:41 +0200	[thread overview]
Message-ID: <20110913232941.GC2078@goldbirke> (raw)
In-Reply-To: <20110913191448.GC14917@elie>

Hi,


On Tue, Sep 13, 2011 at 02:14:48PM -0500, Jonathan Nieder wrote:
> From: Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
> 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@gmail.com>
> ---
> 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

  reply	other threads:[~2011-09-13 23:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4E6F720A.3020103@yahoo.com.br>
     [not found] ` <20110913165847.GB11076@elie>
     [not found]   ` <4E6FA541.7000100@yahoo.com.br>
2011-09-13 19:14     ` [PATCH/RFC] bash: add --word-diff option to diff auto-completion Jonathan Nieder
2011-09-13 23:29       ` SZEDER Gábor [this message]
2011-09-13 23:37         ` SZEDER Gábor
2011-09-16 15:56           ` [PATCH/RFC] bash: add --word-diff option to diff [AND --set-upstream TO push] auto-completion Rodrigo Rosenfeld Rosas
2011-09-16 20:47             ` Jonathan Nieder

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=20110913232941.GC2078@goldbirke \
    --to=szeder@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=lbocseg@yahoo.com.br \
    --cc=trast@student.ethz.ch \
    /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.
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).