patch src/bin/psql/help.c

Started by Alex J. Avrietteabout 23 years ago7 messageshackerspatches
Jump to latest
#1Alex J. Avriette
alex@posixnap.net
hackerspatches

Per the discussion earlier re: sockets and psql

Attachments:

help.c.patchapplication/octet-stream; name=help.c.patch; x-unix-mode=0644Download+6-5
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Alex J. Avriette (#1)
hackerspatches
Re: patch src/bin/psql/help.c

alex avriette writes:

Per the discussion earlier re: sockets and psql

It would be clearer if you list the environment variables in a separate
list below the options, not in the middle of the options without
explanation. It seems, though, that if you list them in psql, you need to
list them everywhere they apply, and that might get a little verbose.

However, the name of the environment variable is PGUSER, not $PGUSER.

--
Peter Eisentraut peter_e@gmx.net

#3Alex J. Avriette
alex@posixnap.net
In reply to: Peter Eisentraut (#2)
hackerspatches
Re: patch src/bin/psql/help.c

Per the discussion earlier re: sockets and psql

It would be clearer if you list the environment variables in a separate
list below the options, not in the middle of the options without
explanation. It seems, though, that if you list them in psql, you
need to
list them everywhere they apply, and that might get a little verbose.

Yeah. I would be happy to wander through and add a quick blurb about
the environment variables to the rest of the bin/ tree. However, I
think you're right, that it is a little too verbose. I couldn't come up
with a better way to phrase it. I suppose it might be better to leave
it out. My original aim was to make sure that the --help output
included the use of a directory for -h.

Hm. Alternatively, something like mpg123's --longhelp comes to mind.
Does anyone else see a need for something like that?

However, the name of the environment variable is PGUSER, not $PGUSER.

Against my better judgment, I'll bite. 'Scuze me?

Alex

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Alex J. Avriette (#3)
hackerspatches
Re: patch src/bin/psql/help.c

alex avriette writes:

My original aim was to make sure that the --help output included the use
of a directory for -h.

Hmm, what does that have to do with the environment variables?

To serve your end, I suppose you could go through the help outputs and
replace "database server host" by "database server host or socket
directory".

--
Peter Eisentraut peter_e@gmx.net

#5Alex J. Avriette
alex@posixnap.net
In reply to: Peter Eisentraut (#4)
hackerspatches
Re: patch src/bin/psql/help.c

Hmm, what does that have to do with the environment variables?

Oh, well, after I read the man page, I realized that it explicitly
states that PGHOST is either the socket directory or host. I figured
specifying which options could be fed environment variables was useful.
It was to me.

To serve your end, I suppose you could go through the help outputs and
replace "database server host" by "database server host or socket
directory".

I think I'll do that.

Alex

#6Bruce Momjian
bruce@momjian.us
In reply to: Alex J. Avriette (#5)
hackerspatches
Re: [HACKERS] patch src/bin/psql/help.c

Here is a patch to do the suggested renaming.

---------------------------------------------------------------------------

alex avriette wrote:

Hmm, what does that have to do with the environment variables?

Oh, well, after I read the man page, I realized that it explicitly
states that PGHOST is either the socket directory or host. I figured
specifying which options could be fed environment variables was useful.
It was to me.

To serve your end, I suppose you could go through the help outputs and
replace "database server host" by "database server host or socket
directory".

I think I'll do that.

Alex

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+28-28
#7Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#6)
patches
Re: [HACKERS] patch src/bin/psql/help.c

Here is an applied patch that adds a mention that client -h can accept
socket directory names too.

---------------------------------------------------------------------------

alex avriette wrote:

I just posted this patch and will apply shortly. Not sure about
displaying defaults --- that could get large.

You rock, Bruce. Thanks.

Yeah. That's why I mentioned the --longhelp option mpg123 has. However,
as nobody was interested in even a "little verbosity," I doubt anyone's
going to lose sleep over a page full of verbosity. Typically, I always
issue a binaryname --help before reading the manpage. If it offered me
a --longhelp at the end of --help, I'd hit that up before the manpage
as well.

But ymmv.

Thank you again.

Alex

-----------------------------------------------------------------------
----

alex avriette wrote:

I assume you decided against continuing with this.

Hi, Bruce.

Ack! I just got so caught up with work, I forgot all the little things
I was working on. I still would like to see it mentioned in the
documentation, but I don't have the time right now to do it.
Additionally, I felt somewhat stymied by the lack of interest in it. I
mean, I answered my question, seems to me that if nobody else has
asked
the question, it mightn't be necessary to patch the documentation or
help.

Eventually Peter and I came to this:

To serve your end, I suppose you could go through the help outputs
and
replace "database server host" by "database server host or socket
directory".

I could probably do this with a grep through the source, but adding
three words is something anyone could do.

What's your feeling on the subject, Bruce?

Alex

---------------------------------------------------------------------
--
----

alex avriette wrote:

Per the discussion earlier re: sockets and psql

[ Attachment, skipping... ]

Synopsis: psql --help now returns:

[ snip ]

Connection options:
-h [ HOSTNAME | DIR ] specify database server host or location
of
socket ($PGHOST, default: local socket)
-p PORT specify database server port ($PGPORT,
default: 5432)
-U NAME specify database user name ($PGUSER,
default: root)
-W prompt for password (should happen
automatically)

Nobody complained when I asked if it was too verbose, and I think it
contributes to the helpfulness of the help. Additionally, the
psql(1)
page and the psql-ref.sgml document already explain this behaviour.

I spoke with Dennis Bjorklund about this on IRC, he suggested that
this
was easier for the translators, and is in the same style as
pg_dump.c
(why is there no src/bin/pg_dump/help.c?).

thanks,
alex

--
alex avriette, unix geek for hire
http://envy.posixnap.net/
alex@avriette.com

---------------------------(end of
broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

-- 
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square,  
Pennsylvania
19073

--
alex avriette - alex@avriette.com
unix systems gladiator
http://envy.posixnap.net/

-- 
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square, Pennsylvania  
19073
Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.331
diff -c -c -r1.331 pg_dump.c
*** src/bin/pg_dump/pg_dump.c	30 May 2003 22:55:15 -0000	1.331
--- src/bin/pg_dump/pg_dump.c	2 Jun 2003 15:03:41 -0000
***************
*** 694,700 ****
"                           disable triggers during data-only  
restore\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host name\n"));
printf(_("  -p, --port=PORT          database server port  
number\n"));
printf(_("  -U, --username=NAME      connect as specified database  
user\n"));
printf(_("  -W, --password           force password prompt (should  
happen automatically)\n"));
--- 694,700 ----
"                           disable triggers during data-only  
restore\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host or socket  
directory\n"));
printf(_("  -p, --port=PORT          database server port  
number\n"));
printf(_("  -U, --username=NAME      connect as specified database  
user\n"));
printf(_("  -W, --password           force password prompt (should  
happen automatically)\n"));
Index: src/bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.20
diff -c -c -r1.20 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c	30 May 2003 23:55:10 -0000	1.20
--- src/bin/pg_dump/pg_dumpall.c	2 Jun 2003 15:03:42 -0000
***************
*** 253,259 ****
printf(_("  --version                output version information,  
then exit\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host name\n"));
printf(_("  -p, --port=PORT          database server port  
number\n"));
printf(_("  -U, --username=NAME      connect as specified database  
user\n"));
printf(_("  -W, --password           force password prompt (should  
happen automatically)\n"));
--- 253,259 ----
printf(_("  --version                output version information,  
then exit\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host or socket  
directory\n"));
printf(_("  -p, --port=PORT          database server port  
number\n"));
printf(_("  -U, --username=NAME      connect as specified database  
user\n"));
printf(_("  -W, --password           force password prompt (should  
happen automatically)\n"));
Index: src/bin/pg_dump/pg_restore.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.45
diff -c -c -r1.45 pg_restore.c
*** src/bin/pg_dump/pg_restore.c	4 Apr 2003 20:42:13 -0000	1.45
--- src/bin/pg_dump/pg_restore.c	2 Jun 2003 15:03:42 -0000
***************
*** 409,415 ****
"                           disable triggers during data-only  
restore\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host name\n"));
printf(_("  -p, --port=PORT          database server port  
number\n"));
printf(_("  -U, --username=NAME      connect as specified database  
user\n"));
printf(_("  -W, --password           force password prompt (should  
happen automatically)\n"));
--- 409,415 ----
"                           disable triggers during data-only  
restore\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host or socket  
directory\n"));
printf(_("  -p, --port=PORT          database server port  
number\n"));
printf(_("  -U, --username=NAME      connect as specified database  
user\n"));
printf(_("  -W, --password           force password prompt (should  
happen automatically)\n"));
Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/help.c,v
retrieving revision 1.72
diff -c -c -r1.72 help.c
*** src/bin/psql/help.c	14 Apr 2003 16:23:36 -0000	1.72
--- src/bin/psql/help.c	2 Jun 2003 15:03:43 -0000
***************
*** 123,129 ****
puts(_("\nConnection options:"));
/* Display default host */
env = getenv("PGHOST");
! 	printf(_("  -h HOSTNAME     specify database server host (default:  
%s)\n"),
env ? env : _("local socket"));
/* Display default port */
env = getenv("PGPORT");
--- 123,129 ----
puts(_("\nConnection options:"));
/* Display default host */
env = getenv("PGHOST");
! 	printf(_("  -h HOSTNAME     specify database server host or socket  
directory (default: %s)\n"),
env ? env : _("local socket"));
/* Display default port */
env = getenv("PGPORT");
Index: src/bin/scripts/clusterdb
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/clusterdb,v
retrieving revision 1.11
diff -c -c -r1.11 clusterdb
*** src/bin/scripts/clusterdb	14 May 2003 03:26:03 -0000	1.11
--- src/bin/scripts/clusterdb	2 Jun 2003 15:03:43 -0000
***************
*** 123,129 ****
echo "  --help                    show this help, then exit"
echo
echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME       database server host"
echo "  -p, --port=PORT           database server port"
echo "  -U, --username=USERNAME   user name to connect as"
echo "  -W, --password            prompt for password"
--- 123,129 ----
echo "  --help                    show this help, then exit"
echo
echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME       database server host or socket  
directory"
echo "  -p, --port=PORT           database server port"
echo "  -U, --username=USERNAME   user name to connect as"
echo "  -W, --password            prompt for password"
Index: src/bin/scripts/createdb.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/createdb.c,v
retrieving revision 1.2
diff -c -c -r1.2 createdb.c
*** src/bin/scripts/createdb.c	14 May 2003 03:26:03 -0000	1.2
--- src/bin/scripts/createdb.c	2 Jun 2003 15:03:43 -0000
***************
*** 223,229 ****
printf(_("  --help                    show this help, then  
exit\n"));
printf(_("  --version                 output version information,  
then exit\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
--- 223,229 ----
printf(_("  --help                    show this help, then  
exit\n"));
printf(_("  --version                 output version information,  
then exit\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or  
socket directory\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/createlang.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/createlang.c,v
retrieving revision 1.2
diff -c -c -r1.2 createlang.c
*** src/bin/scripts/createlang.c	14 May 2003 03:26:03 -0000	1.2
--- src/bin/scripts/createlang.c	2 Jun 2003 15:03:43 -0000
***************
*** 276,282 ****
printf(_("  -e, --echo                show the commands being sent  
to the server\n"));
printf(_("  -l, --list                show a list of currently  
installed languages\n"));
printf(_("  -L, --pglib=DIRECTORY     find language interpreter  
file in DIRECTORY\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
--- 276,282 ----
printf(_("  -e, --echo                show the commands being sent  
to the server\n"));
printf(_("  -l, --list                show a list of currently  
installed languages\n"));
printf(_("  -L, --pglib=DIRECTORY     find language interpreter  
file in DIRECTORY\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or  
socket directory\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/createuser.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/createuser.c,v
retrieving revision 1.3
diff -c -c -r1.3 createuser.c
*** src/bin/scripts/createuser.c	27 May 2003 19:36:54 -0000	1.3
--- src/bin/scripts/createuser.c	2 Jun 2003 15:03:43 -0000
***************
*** 248,254 ****
printf(_("  --help                    show this help, then  
exit\n"));
printf(_("  --version                 output version information,  
then exit\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as (not  
the one to create)\n"));
printf(_("  -W, --password            prompt for password to  
connect\n"));
--- 248,254 ----
printf(_("  --help                    show this help, then  
exit\n"));
printf(_("  --version                 output version information,  
then exit\n"));
printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or  
socket directory\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as (not  
the one to create)\n"));
printf(_("  -W, --password            prompt for password to  
connect\n"));
Index: src/bin/scripts/dropdb.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/dropdb.c,v
retrieving revision 1.3
diff -c -c -r1.3 dropdb.c
*** src/bin/scripts/dropdb.c	27 May 2003 19:36:54 -0000	1.3
--- src/bin/scripts/dropdb.c	2 Jun 2003 15:03:43 -0000
***************
*** 146,152 ****
printf(_("  -e, --echo                show the commands being sent  
to the server\n"));
printf(_("  -i, --interactive         prompt before deleting  
anything\n"));
printf(_("  -q, --quiet               don't write any messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
--- 146,152 ----
printf(_("  -e, --echo                show the commands being sent  
to the server\n"));
printf(_("  -i, --interactive         prompt before deleting  
anything\n"));
printf(_("  -q, --quiet               don't write any messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or  
socket directory\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/droplang.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/droplang.c,v
retrieving revision 1.2
diff -c -c -r1.2 droplang.c
*** src/bin/scripts/droplang.c	14 May 2003 03:26:03 -0000	1.2
--- src/bin/scripts/droplang.c	2 Jun 2003 15:03:43 -0000
***************
*** 244,250 ****
printf(_("  -d, --dbname=DBNAME       database to install language  
in\n"));
printf(_("  -e, --echo                show the commands being sent  
to the server\n"));
printf(_("  -l, --list                show a list of currently  
installed languages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
--- 244,250 ----
printf(_("  -d, --dbname=DBNAME       database to install language  
in\n"));
printf(_("  -e, --echo                show the commands being sent  
to the server\n"));
printf(_("  -l, --list                show a list of currently  
installed languages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or  
socket directory\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as\n"));
printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/dropuser.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/dropuser.c,v
retrieving revision 1.3
diff -c -c -r1.3 dropuser.c
*** src/bin/scripts/dropuser.c	27 May 2003 19:36:55 -0000	1.3
--- src/bin/scripts/dropuser.c	2 Jun 2003 15:03:43 -0000
***************
*** 143,152 ****
printf(_("Usage:\n"));
printf(_("  %s [OPTION]... [USERNAME]\n"), progname);
printf(_("\nOptions:\n"));
!     printf(_("  -e, --echo                show the commands being  
sent to the server\n"));
printf(_("  -i, --interactive         prompt before deleting  
anything\n"));
!     printf(_("  -q, --quiet               don't write any  
messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as (not  
the one to drop)\n"));
printf(_("  -W, --password            prompt for password to  
connect\n"));
--- 143,152 ----
printf(_("Usage:\n"));
printf(_("  %s [OPTION]... [USERNAME]\n"), progname);
printf(_("\nOptions:\n"));
! 	printf(_("  -e, --echo                show the commands being sent  
to the server\n"));
printf(_("  -i, --interactive         prompt before deleting  
anything\n"));
! 	printf(_("  -q, --quiet               don't write any messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or  
socket directory\n"));
printf(_("  -p, --port=PORT           database server port\n"));
printf(_("  -U, --username=USERNAME   user name to connect as (not  
the one to drop)\n"));
printf(_("  -W, --password            prompt for password to  
connect\n"));
Index: src/bin/scripts/vacuumdb
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v
retrieving revision 1.27
diff -c -c -r1.27 vacuumdb
*** src/bin/scripts/vacuumdb	14 May 2003 03:26:03 -0000	1.27
--- src/bin/scripts/vacuumdb	2 Jun 2003 15:03:43 -0000
***************
*** 140,146 ****
echo " --help                           show this help, then exit"
echo
echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME             database server host"
echo "  -p, --port=PORT                 database server port"
echo "  -U, --username=USERNAME         user name to connect as"
echo "  -W, --password                  prompt for password"
--- 140,146 ----
echo " --help                           show this help, then exit"
echo
echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME             database server host or  
socket directory"
echo "  -p, --port=PORT                 database server port"
echo "  -U, --username=USERNAME         user name to connect as"
echo "  -W, --password                  prompt for password"

--
alex avriette - alex@avriette.com
unix systems gladiator
http://envy.posixnap.net/

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/pgpatches/sockettext/plainDownload+28-28