diff options
author | David Aguilar <davvid@gmail.com> | 2010-01-15 14:03:43 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-15 15:04:31 -0800 |
commit | f47f1e2ce8b4022113120b32decb4436341dc3aa (patch) | |
tree | 25c7dbb1e9f3cf122faf62d86e094ad136ad2a27 /git-difftool.perl | |
parent | a9e11220c2656cc5d7baac4d0735c04f9be46438 (diff) | |
download | git-f47f1e2ce8b4022113120b32decb4436341dc3aa.tar.gz |
difftool: Add '-x' and as an alias for '--extcmd'
This adds '-x' as a shorthand for the '--extcmd' option.
Arguments to '--extcmd' can be specified separately, which
was not originally possible.
This also fixes the brief help text so that it mentions
both '-x' and '--extcmd'.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-difftool.perl')
-rwxr-xr-x | git-difftool.perl | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/git-difftool.perl b/git-difftool.perl index f8ff245756..d975d072db 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# Copyright (c) 2009 David Aguilar +# Copyright (c) 2009, 2010 David Aguilar # # This is a wrapper around the GIT_EXTERNAL_DIFF-compatible # git-difftool--helper script. @@ -23,8 +23,9 @@ my $DIR = abs_path(dirname($0)); sub usage { print << 'USAGE'; -usage: git difftool [-g|--gui] [-t|--tool=<tool>] [-y|--no-prompt] - ["git diff" options] +usage: git difftool [-t|--tool=<tool>] [-x|--extcmd=<cmd>] + [-y|--no-prompt] [-g|--gui] + ['git diff' options] USAGE exit 1; } @@ -62,14 +63,20 @@ sub generate_command $skip_next = 1; next; } - if ($arg =~ /^--extcmd=/) { - $ENV{GIT_DIFFTOOL_EXTCMD} = substr($arg, 9); - next; - } if ($arg =~ /^--tool=/) { $ENV{GIT_DIFF_TOOL} = substr($arg, 7); next; } + if ($arg eq '-x' || $arg eq '--extcmd') { + usage() if $#ARGV <= $idx; + $ENV{GIT_DIFFTOOL_EXTCMD} = $ARGV[$idx + 1]; + $skip_next = 1; + next; + } + if ($arg =~ /^--extcmd=/) { + $ENV{GIT_DIFFTOOL_EXTCMD} = substr($arg, 9); + next; + } if ($arg eq '-g' || $arg eq '--gui') { my $tool = Git::command_oneline('config', 'diff.guitool'); |