Re: Add --check option to pgindent

Поиск
Список
Период
Сортировка
От Tristan Partin
Тема Re: Add --check option to pgindent
Дата
Msg-id CXSGUFLDISHS.3LK6EM9GMPP7L@neon.tech
обсуждение исходный текст
Ответ на Re: Add --check option to pgindent  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Ответы Re: Add --check option to pgindent  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Список 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@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 <tristan@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)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jelte Fennema-Nio
Дата:
Сообщение: Re: Add new for_each macros for iterating over a List that do not require ListCell pointer
Следующее
От: Jacob Burroughs
Дата:
Сообщение: Re: libpq compression (part 3)