Skip to contentSkip to conversation

difftool: add a -y shortcut for --no-prompt

PATCH Superseded David Aguilar 2 participants 2 messages Jun 15, 2016 Documentation

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 difftool: add a -y shortcut for --no-prompt

This is another consistency cleanup to make git-difftool's options match git-mergetool.

---

This also fixes the style used for the -h option which I should have caught in my previous patch. Doh!

 Documentation/git-difftool.txt |    3 ++-
 git-difftool.perl              |    6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
Documentation/git-difftool.txt +2 -1
index 23070c1..be1020d 100644
@@ -7,7 +7,7 @@ git-difftool - Show changes using common diff tools
 
 SYNOPSIS
 --------
-'git difftool' [--tool=<tool>] [--no-prompt] [<'git diff' options>]
+'git difftool' [--tool=<tool>] [-y|--no-prompt] [<'git diff' options>]
 
 DESCRIPTION
 -----------
@@ -17,6 +17,7 @@ to 'git-diff' and accepts the same options and arguments.
 
 OPTIONS
 -------
+-y::
 --no-prompt::
 	Do not prompt before launching a diff tool.
 
git-difftool.perl +3 -3
index 207dd50..5bc64d5 100755
@@ -18,7 +18,7 @@ my $DIR = abs_path(dirname($0));
 sub usage
 {
 	print << 'USAGE';
-usage: git difftool [--tool=<tool>] [--no-prompt] ["git diff" options]
+usage: git difftool [--tool=<tool>] [-y|--no-prompt] ["git diff" options]
 USAGE
 	exit 1;
 }
@@ -60,11 +60,11 @@ sub generate_command
 			$ENV{GIT_DIFF_TOOL} = substr($arg, 7);
 			next;
 		}
-		if ($arg eq '--no-prompt') {
+		if ($arg eq '-y' || '--no-prompt') {
 			$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
 			next;
 		}
-		if ($arg eq '-h' or $arg eq '--help') {
+		if ($arg eq '-h' || $arg eq '--help') {
 			usage();
 		}
 		push @command, $arg;
Signature · 1 line
1.6.2.1.303.g63699
#1 lore raw

git-difftool.perl sub generate_command · line 63

Quoted 9 lines · David Aguilar

This is another consistency cleanup to make git-difftool's options match git-mergetool.
...

git-difftool.perl +1 -1
@@ -60,11 +60,11 @@ sub generate_command
 			$ENV{GIT_DIFF_TOOL} = substr($arg, 7);
 			next;
 		}
-		if ($arg eq '--no-prompt') {
+		if ($arg eq '-y' || '--no-prompt') {

This was the typo that broke 'pu'; I fixed it up and re-queued the series.