On Tue Dec 19, 2023 at 10:36 AM CST, Jelte Fennema-Nio wrote:
On Mon, 18 Dec 2023 at 22:18, Tristan Partin <tris...@neon.tech> wrote:
> Here is an additional patch which implements the behavior you described.
> The first patch is just Daniel's squashed version of my patches.
I think we'd still want the early exit behaviour when only --check is
provided. No need to spend time checking more files if you're not
doing anything else.
Good point. Patch looks good.
On Mon, 18 Dec 2023 at 22:34, Tristan Partin <tris...@neon.tech> wrote:
> To me, the two options seem at odds, like you either check or write. How
> would you feel about just capturing the diffs that are printed and
> patch(1)-ing them?
I tried capturing the diffs and patching them, but simply piping the
pgindent output to patch(1) didn't work because the pipe loses the
exit code of pgindent. -o pipefail would help with this, but it's not
available in all shells. Also then it's suddenly unclear if pgident
failed or if patch failed.
I was envisioning something along the lines of:
pgindent --check --diff > patches.txt
status=$?
patch <patches.txt # no idea if this works, or if you need a for loop
with manual parsing
exit $status
--
Tristan Partin
Neon (https://neon.tech)