This adds two modes of running pgindent, neither of which results in any changes being made to the source code. The --show-diff option shows what changes would have been made, and the --silent-diff option just exits with a status of 2 if any changes would be made. The second of these is intended for scripting use in places such as git hooks.
Along the way some code cleanup is done, and a --help option is also added.
Reviewed by Tom Lane
b90f0b5747 Add non-destructive modes to pgindent
src/tools/pgindent/pgindent | 98 ++++++++++++++++++++++++++++++-----------
src/tools/pgindent/pgindent.man | 7 +++
2 files changed, 79 insertions(+), 26 deletions(-)