psql help message contains excessive indentations

Started by Kyotaro Horiguchiover 2 years ago9 messages
#1Kyotaro Horiguchi
horikyota.ntt@gmail.com
1 attachment(s)

This topic is extracted from [1]/messages/by-id/20230830.103356.1909699532104167477.horikyota.ntt@gmail.com.

As mentioned there, in psql, running \? displays the following lines.

\gdesc describe result of query, without executing it
\gexec execute query, then execute each value in its result
\gset [PREFIX] execute query and store result in psql variables
\gx [(OPTIONS)] [FILE] as \g, but forces expanded output mode
\q quit psql
\watch [[i=]SEC] [c=N] [m=MIN]

!> execute query every SEC seconds, up to N times
!> stop if less than MIN rows are returned

The last two lines definitely have some extra indentation.
I've attached a patch that fixes this.

[1]: /messages/by-id/20230830.103356.1909699532104167477.horikyota.ntt@gmail.com

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

psql_help_remove_extra_indentation.patchtext/x-patch; charset=us-asciiDownload
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 38c165a627..f8eeef8e4e 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -201,8 +201,8 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\gx [(OPTIONS)] [FILE] as \\g, but forces expanded output mode\n");
 	HELP0("  \\q                     quit psql\n");
 	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n");
-	HELP0("                          execute query every SEC seconds, up to N times\n");
-	HELP0("                          stop if less than MIN rows are returned\n");
+	HELP0("                         execute query every SEC seconds, up to N times\n");
+	HELP0("                         stop if less than MIN rows are returned\n");
 	HELP0("\n");
 
 	HELP0("Help\n");
#2Yugo NAGATA
nagata@sraoss.co.jp
In reply to: Kyotaro Horiguchi (#1)
Re: psql help message contains excessive indentations

On Thu, 07 Sep 2023 14:29:56 +0900 (JST)
Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:

This topic is extracted from [1].

As mentioned there, in psql, running \? displays the following lines.

\gdesc describe result of query, without executing it
\gexec execute query, then execute each value in its result
\gset [PREFIX] execute query and store result in psql variables
\gx [(OPTIONS)] [FILE] as \g, but forces expanded output mode
\q quit psql
\watch [[i=]SEC] [c=N] [m=MIN]

!> execute query every SEC seconds, up to N times
!> stop if less than MIN rows are returned

The last two lines definitely have some extra indentation.

Agreed.

I've attached a patch that fixes this.

I wonder this better to fix this in similar way to other places where the
description has multiple lines., like "\g [(OPTIONS)] [FILE]".

Regards,
Yugo Nagata

[1] /messages/by-id/20230830.103356.1909699532104167477.horikyota.ntt@gmail.com

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

--
Yugo NAGATA <nagata@sraoss.co.jp>

#3Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Yugo NAGATA (#2)
Re: psql help message contains excessive indentations

At Thu, 7 Sep 2023 15:02:49 +0900, Yugo NAGATA <nagata@sraoss.co.jp> wrote in

On Thu, 07 Sep 2023 14:29:56 +0900 (JST)
Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:

\q quit psql
\watch [[i=]SEC] [c=N] [m=MIN]

!> execute query every SEC seconds, up to N times
!> stop if less than MIN rows are returned

The last two lines definitely have some extra indentation.

Agreed.

I've attached a patch that fixes this.

I wonder this better to fix this in similar way to other places where the
description has multiple lines., like "\g [(OPTIONS)] [FILE]".

It looks correct to me:

\errverbose show most recent error message at maximum verbosity
\g [(OPTIONS)] [FILE] execute query (and send result to file or |pipe);
\g with no arguments is equivalent to a semicolon
\gdesc describe result of query, without executing it

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#4Yugo NAGATA
nagata@sraoss.co.jp
In reply to: Kyotaro Horiguchi (#3)
1 attachment(s)
Re: psql help message contains excessive indentations

On Thu, 07 Sep 2023 15:36:10 +0900 (JST)
Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:

At Thu, 7 Sep 2023 15:02:49 +0900, Yugo NAGATA <nagata@sraoss.co.jp> wrote in

On Thu, 07 Sep 2023 14:29:56 +0900 (JST)
Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:

\q quit psql
\watch [[i=]SEC] [c=N] [m=MIN]

!> execute query every SEC seconds, up to N times
!> stop if less than MIN rows are returned

The last two lines definitely have some extra indentation.

Agreed.

I've attached a patch that fixes this.

I wonder this better to fix this in similar way to other places where the
description has multiple lines., like "\g [(OPTIONS)] [FILE]".

It looks correct to me:

Yes. So, I mean how about fixing \watch description as the attached patch.

\errverbose show most recent error message at maximum verbosity
\g [(OPTIONS)] [FILE] execute query (and send result to file or |pipe);
\g with no arguments is equivalent to a semicolon
\gdesc describe result of query, without executing it

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

--
Yugo NAGATA <nagata@sraoss.co.jp>

Attachments:

v2_psql_help_remove_extra_indentation.patchtext/x-diff; name=v2_psql_help_remove_extra_indentation.patchDownload
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 38c165a627..12280c0e54 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -200,9 +200,9 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\gset [PREFIX]         execute query and store result in psql variables\n");
 	HELP0("  \\gx [(OPTIONS)] [FILE] as \\g, but forces expanded output mode\n");
 	HELP0("  \\q                     quit psql\n");
-	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n");
-	HELP0("                          execute query every SEC seconds, up to N times\n");
-	HELP0("                          stop if less than MIN rows are returned\n");
+	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n"
+		  "                         execute query every SEC seconds, up to N times\n"
+		  "                         stop if less than MIN rows are returned\n");
 	HELP0("\n");
 
 	HELP0("Help\n");
#5Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Yugo NAGATA (#4)
Re: psql help message contains excessive indentations

At Thu, 7 Sep 2023 16:08:10 +0900, Yugo NAGATA <nagata@sraoss.co.jp> wrote in

On Thu, 07 Sep 2023 15:36:10 +0900 (JST)
Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:

At Thu, 7 Sep 2023 15:02:49 +0900, Yugo NAGATA <nagata@sraoss.co.jp> wrote in

I wonder this better to fix this in similar way to other places where the
description has multiple lines., like "\g [(OPTIONS)] [FILE]".

It looks correct to me:

Yes. So, I mean how about fixing \watch description as the attached patch.

Ah. I see. I thought you meant that line needed the same change.

\errverbose show most recent error message at maximum verbosity
\g [(OPTIONS)] [FILE] execute query (and send result to file or |pipe);
\g with no arguments is equivalent to a semicolon
\gdesc describe result of query, without executing it

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#6Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Yugo NAGATA (#4)
Re: psql help message contains excessive indentations

On 2023-Sep-07, Yugo NAGATA wrote:

Yes. So, I mean how about fixing \watch description as the attached patch.

diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 38c165a627..12280c0e54 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -200,9 +200,9 @@ slashUsage(unsigned short int pager)
HELP0("  \\gset [PREFIX]         execute query and store result in psql variables\n");
HELP0("  \\gx [(OPTIONS)] [FILE] as \\g, but forces expanded output mode\n");
HELP0("  \\q                     quit psql\n");
-	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n");
-	HELP0("                          execute query every SEC seconds, up to N times\n");
-	HELP0("                          stop if less than MIN rows are returned\n");
+	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n"
+		  "                         execute query every SEC seconds, up to N times\n"
+		  "                         stop if less than MIN rows are returned\n");

Yeah, this looks right to me -- the whole help entry as a single
translatable unit, instead of three separately translatable lines.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)

#7Yugo NAGATA
nagata@sraoss.co.jp
In reply to: Alvaro Herrera (#6)
Re: psql help message contains excessive indentations

On Thu, 7 Sep 2023 13:06:35 +0200
Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

On 2023-Sep-07, Yugo NAGATA wrote:

Yes. So, I mean how about fixing \watch description as the attached patch.

diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 38c165a627..12280c0e54 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -200,9 +200,9 @@ slashUsage(unsigned short int pager)
HELP0("  \\gset [PREFIX]         execute query and store result in psql variables\n");
HELP0("  \\gx [(OPTIONS)] [FILE] as \\g, but forces expanded output mode\n");
HELP0("  \\q                     quit psql\n");
-	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n");
-	HELP0("                          execute query every SEC seconds, up to N times\n");
-	HELP0("                          stop if less than MIN rows are returned\n");
+	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n"
+		  "                         execute query every SEC seconds, up to N times\n"
+		  "                         stop if less than MIN rows are returned\n");

Yeah, this looks right to me -- the whole help entry as a single
translatable unit, instead of three separately translatable lines.

Thank you for your explanation. I understood it. I thought of just
imitating other places, and I didn't know each is a single translatable
unit.

Regards,
Yugo Nagata

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)

--
Yugo NAGATA <nagata@sraoss.co.jp>

#8Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Alvaro Herrera (#6)
Re: psql help message contains excessive indentations

At Thu, 7 Sep 2023 13:06:35 +0200, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote in

On 2023-Sep-07, Yugo NAGATA wrote:

+	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n"
+		  "                         execute query every SEC seconds, up to N times\n"
+		  "                         stop if less than MIN rows are returned\n");

Yeah, this looks right to me -- the whole help entry as a single
translatable unit, instead of three separately translatable lines.

+1

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#9Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Yugo NAGATA (#7)
Re: psql help message contains excessive indentations

On 2023-Sep-07, Yugo NAGATA wrote:

Thank you for your explanation. I understood it. I thought of just
imitating other places, and I didn't know each is a single translatable
unit.

Thanks for reviewing, and Kyotaro for reporting. Pushed now.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Estoy de acuerdo contigo en que la verdad absoluta no existe...
El problema es que la mentira sí existe y tu estás mintiendo" (G. Lama)