v2-0002-Rename-show-diff-to-diff-in-pgindent.patch
text/x-patch
Filename: v2-0002-Rename-show-diff-to-diff-in-pgindent.patch
Type: text/x-patch
Part: 1
Message:
Re: Add --check option to pgindent
Patch
Format: format-patch
Series: patch v2-0002
Subject: Rename --show-diff to --diff in pgindent
| File | + | − |
|---|---|---|
| src/tools/pgindent/pgindent | 9 | 9 |
From ddd5cdaf8e967ddf84beb49ca64b5bed039b71ac Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@neon.tech>
Date: Thu, 14 Dec 2023 10:36:05 -0600
Subject: [PATCH v2 2/3] Rename --show-diff to --diff in pgindent
--diff should be a little bit more self-explanatory for people coming
from other similar formatter/linting tooling.
---
src/tools/pgindent/pgindent | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index fe0bd21f4a..067b77be54 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -22,7 +22,7 @@ my $indent_opts =
my $devnull = File::Spec->devnull;
my ($typedefs_file, $typedef_str, @excludes,
- $indent, $build, $show_diff,
+ $indent, $build, $diff,
$check, $help, @commits,);
$help = 0;
@@ -34,14 +34,14 @@ my %options = (
"list-of-typedefs=s" => \$typedef_str,
"excludes=s" => \@excludes,
"indent=s" => \$indent,
- "show-diff" => \$show_diff,
+ "diff" => \$diff,
"check" => \$check,);
GetOptions(%options) || usage("bad command line argument");
usage() if $help;
-usage("Cannot have both --check and --show-diff")
- if $check && $show_diff;
+usage("Cannot have both --check and --diff")
+ if $check && $diff;
usage("Cannot use --commit with command line file list")
if (@commits && @ARGV);
@@ -294,7 +294,7 @@ sub run_indent
return $source;
}
-sub show_diff
+sub diff
{
my $indented = shift;
my $source_filename = shift;
@@ -323,7 +323,7 @@ Options:
--list-of-typedefs=STR string containing typedefs, space separated
--excludes=PATH file containing list of filename patterns to ignore
--indent=PATH path to pg_bsd_indent program
- --show-diff show the changes that would be made
+ --diff show the changes that would be made
--check exit with status 2 if any changes would be made
The --excludes and --commit options can be given more than once.
EOF
@@ -419,16 +419,16 @@ foreach my $source_filename (@files)
{
if ($check)
{
- print show_diff($source, $source_filename);
+ print diff($source, $source_filename);
exit 2;
}
elsif ($check)
{
exit 2;
}
- elsif ($show_diff)
+ elsif ($diff)
{
- print show_diff($source, $source_filename);
+ print diff($source, $source_filename);
}
else
{
--
Tristan Partin
Neon (https://neon.tech)