Re: Feature request: be able to pass arguments to difftool command
- From
H.Merijn Brand <h.m.brand@xs4all.nl>
- Date
- Aug 29, 2018, 07:18 UTC
- Message-ID
- <20180829091838.2eee8a6a@pc09.procura.nl>
- In-Reply-To
- <xmqqpny2ffjv.fsf@gitster-ct.c.googlers.com>
On Tue, 28 Aug 2018 12:37:40 -0700, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes: > > > So, my wish would be to have an option, possibly using -- to pass > > additional command line arguments to git difftool, so that > > > > $ git difftool $commit~1..$commit -- -m -v2 > > > > would pass the arguments after -- transparantly to ccdiff (in my case) > > At the syntax level passing any option after "--" would be a no > starter, as I would imagine that "git difftool $revs -- $paths" > should still be supported. > > At the concept level, however, I can see why such a feature would be > useful. Perhaps > > $ git difftool --backend-option=-m --backend-option=-v2 HEAD > $ git mergetool --backend-option=--foo
This would mean I can just pass remaining arguments, like this?
--8<--- ~/bin/git-ccdiff #!/usr/bin/env perl use 5.18.3; use warnings;
my $commit;
@ARGV && $ARGV[0] !~ m/^-/ and $commit = shift;
my @git = qw( git difftool ); defined $commit and push @git, "$commit~1..$commit"; system @git, @ARGV; -->8---
> with appropriate way(s) [*1*] to make it easier to type (and > implement) would be an acceptable avenue to pursue, I wonder?
I like it, as long as they are all separate options in the backend and not available in one single variable that needs to be split
I can envision a configure variable like
backends.options.separator = U+2063
so the backend can safely split on that itself. But I also see this as overly complex en over-engineering
Show 6 quoted lines
> [Footnote] > > *1* There are various possible ways, not all of them are mutually > incompatible. > > a. Give a short-form synonym, e.g. -X, to "--backend-option";
I like it
> b. Assume that backend option always begins with a dash and add > one when missing, e.g. -Xm becomes --backend-option=-m
I guess not: there might be tools that do not work like that, e.g. xfreerdp changed all their rememberable and logic options to the weird stupid syntax they use now, including mixing -, -- and +
rdesktop -u user -p - -g 1280x1024 -a 16 -r clipboard:CLIPBOARD host
->
xfreerdp -u user --from-stdin -g 1280x1024 -a 16 --plugin clipbrd host
->
xfreerdp /u:user /from-stdin /size:1280x1024 /bpp:16 +clipboard /v:host
> c. Allow giving multiple backend options on a single option and > split at whitespace, e.g. --backend-option="-m -v2"
That is the weak part in my workaround, as it will break on options like
--backend-option='--config="/path/to/My Configuration/My Application"'
> d. Allow difftool.$toolname.opts configuration variable that is > multi-valued, so you can say > > git -c difftool.ccdiff.opts=-v2 -c difftool.ccdiff.opts=-m difftool
Hmm, maybe harder to explain, but why not
> (of course, not necessarily from the command line but the > point is you could configure it) > > Some of these (e.g. b, c) may not be desirable, though.
-- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.29 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/