From: | "Tristan Partin" <tristan(at)neon(dot)tech> |
---|---|
To: | "Jelte Fennema-Nio" <postgres(at)jeltef(dot)nl> |
Cc: | "Daniel Gustafsson" <daniel(at)yesql(dot)se>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Euler Taveira" <euler(at)eulerto(dot)com>, "Michael Banck" <mbanck(at)gmx(dot)net>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add --check option to pgindent |
Date: | 2023-12-19 16:54:36 |
Message-ID: | CXSGUFLDISHS.3LK6EM9GMPP7L@neon.tech |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue Dec 19, 2023 at 10:36 AM CST, Jelte Fennema-Nio wrote:
> On Mon, 18 Dec 2023 at 22:18, Tristan Partin <tristan(at)neon(dot)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 <tristan(at)neon(dot)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)
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Burroughs | 2023-12-19 17:02:41 | Re: libpq compression (part 3) |
Previous Message | Jelte Fennema-Nio | 2023-12-19 16:47:42 | Re: Add new for_each macros for iterating over a List that do not require ListCell pointer |