pgsql: Use $INDENT rather than indent throughout the pgindent code

Started by Alvaro Herreraover 15 years ago7 messagescomitters
Jump to latest
#1Alvaro Herrera
alvherre@2ndquadrant.com

Use $INDENT rather than indent throughout the pgindent code

This allows the user to change the path to be used more easily.
Also, change URL in README.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c4d124365b9b535e8c98e4568ade3e0c15b11810

Modified Files
--------------
src/tools/pgindent/README | 2 +-
src/tools/pgindent/pgindent | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)

#2Andrew Dunstan
andrew@dunslane.net
In reply to: Alvaro Herrera (#1)
Re: pgsql: Use $INDENT rather than indent throughout the pgindent code

On 02/17/2011 08:23 PM, Alvaro Herrera wrote:

Use $INDENT rather than indent throughout the pgindent code

+INDENT=`which indent`

How universally available is "which"?

cheers

andrew

#3Bruce Momjian
bruce@momjian.us
In reply to: Andrew Dunstan (#2)
Re: pgsql: Use $INDENT rather than indent throughout the pgindent code

Andrew Dunstan wrote:

On 02/17/2011 08:23 PM, Alvaro Herrera wrote:

Use $INDENT rather than indent throughout the pgindent code

+INDENT=`which indent`

How universally available is "which"?

I have 'which'. I am unclear how 'which' helps in this case.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#3)
Re: pgsql: Use $INDENT rather than indent throughout the pgindent code

Bruce Momjian <bruce@momjian.us> writes:

Andrew Dunstan wrote:

On 02/17/2011 08:23 PM, Alvaro Herrera wrote:

Use $INDENT rather than indent throughout the pgindent code
+INDENT=`which indent`

How universally available is "which"?

I have 'which'. I am unclear how 'which' helps in this case.

It doesn't. Anything 'which' would find could perfectly well be invoked
by saying plain old "indent". What would actually be useful here is a
convenient way to override the script's default value of INDENT, but
this coding doesn't offer that. I'd suggest something more like

if [ -z "$INDENT" ]; then
INDENT=indent
fi

regards, tom lane

#5Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#4)
Re: pgsql: Use $INDENT rather than indent throughout the pgindent code

Excerpts from Tom Lane's message of vie feb 18 00:34:33 -0300 2011:

Bruce Momjian <bruce@momjian.us> writes:

Andrew Dunstan wrote:

On 02/17/2011 08:23 PM, Alvaro Herrera wrote:

Use $INDENT rather than indent throughout the pgindent code
+INDENT=`which indent`

How universally available is "which"?

I have 'which'. I am unclear how 'which' helps in this case.

Hey, you could have asked when I showed you the patch yesterday on IM.

It doesn't. Anything 'which' would find could perfectly well be invoked
by saying plain old "indent".

It helps because I can easily change the value in the script in a single
place to what I want. That's a bit less inconvenient than having to
edit more than one place. However ...

What would actually be useful here is a
convenient way to override the script's default value of INDENT, but
this coding doesn't offer that. I'd suggest something more like

if [ -z "$INDENT" ]; then
INDENT=indent
fi

... this is certainly better. I'll change it to this.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#6Andrew Dunstan
andrew@dunslane.net
In reply to: Alvaro Herrera (#5)
Re: pgsql: Use $INDENT rather than indent throughout the pgindent code

On 02/18/2011 10:44 AM, Alvaro Herrera wrote:

What would actually be useful here is a
convenient way to override the script's default value of INDENT, but
this coding doesn't offer that. I'd suggest something more like

if [ -z "$INDENT" ]; then
INDENT=indent
fi

... this is certainly better. I'll change it to this.

maybe PGINDENT instead of INDENT?

cheers

andrew

#7Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#5)
Re: pgsql: Use $INDENT rather than indent throughout the pgindent code

Alvaro Herrera wrote:

Excerpts from Tom Lane's message of vie feb 18 00:34:33 -0300 2011:

Bruce Momjian <bruce@momjian.us> writes:

Andrew Dunstan wrote:

On 02/17/2011 08:23 PM, Alvaro Herrera wrote:

Use $INDENT rather than indent throughout the pgindent code
+INDENT=`which indent`

How universally available is "which"?

I have 'which'. I am unclear how 'which' helps in this case.

Hey, you could have asked when I showed you the patch yesterday on IM.

I thought I was missing something; I figured there must be some reason.

It doesn't. Anything 'which' would find could perfectly well be invoked
by saying plain old "indent".

It helps because I can easily change the value in the script in a single
place to what I want. That's a bit less inconvenient than having to
edit more than one place. However ...

What would actually be useful here is a
convenient way to override the script's default value of INDENT, but
this coding doesn't offer that. I'd suggest something more like

if [ -z "$INDENT" ]; then
INDENT=indent
fi

... this is certainly better. I'll change it to this.

OK.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +