On 2014-08-28 13:20:07 +0200, Andres Freund wrote:
> I've attached a incremental patch.

Apparently I didn't attach the patch, as so much a file containing the
name of the patchfile...


Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 6d3189d..b14db45 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -2581,12 +2581,15 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
 
 
       <varlistentry>
-        <term><literal>\? [ options | variables ]</literal></term>
+        <term><literal>\? [ <replaceable class="parameter">topic</replaceable> ]</literal></term>
         <listitem>
         <para>
-        Shows help information about the backslash commands.  This command can have a
-        option "variables" or "options" to take help for psql configuration variables
-        or psql command line options.
+        Shows help information. The parameter
+        <replaceable class="parameter">topic</replaceable> can be
+        <literal>commands</> (the default) to show help about backslash
+        commands, <literal>options</> to show information about commandline
+        arguments, or <literal>variables</> to show information about
+        variables influencing <application>psql</>'s behaviour or display.
         </para>
         </listitem>
       </varlistentry>
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 12cbb20..7e4626c 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1507,12 +1507,12 @@ exec_command(const char *cmd,
 		char	   *opt0 = psql_scan_slash_option(scan_state,
 													OT_NORMAL, NULL, false);
 
-		if (!opt0)
+		if (!opt0 || strcmp(opt0, "commands") == 0)
 			slashUsage(pset.popt.topt.pager);
-		else if (strcmp(opt0, "variables") == 0)
-			help_variables(pset.popt.topt.pager);
 		else if (strcmp(opt0, "options") == 0)
 			usage(pset.popt.topt.pager);
+		else if (strcmp(opt0, "variables") == 0)
+			helpVariables(pset.popt.topt.pager);
 		else
 			slashUsage(pset.popt.topt.pager);
 	}
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 5e7953d..e0d1d13 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -171,7 +171,7 @@ slashUsage(unsigned short int pager)
 
 	fprintf(output, _("Help\n"));
 
-	fprintf(output, _("  \\?                     description of all psql commands\n"));
+	fprintf(output, _("  \\? [commands]          description of all psql commands\n"));
 	fprintf(output, _("  \\? options             description of psql options\n"));
 	fprintf(output, _("  \\? variables           description of all psql configuration variables\n"));
 	fprintf(output, _("  \\h [NAME]              help on syntax of SQL commands, * for all commands\n"));
@@ -294,10 +294,12 @@ slashUsage(unsigned short int pager)
 
 
 /*
- * show list of available variables (options) from command line
+ * helpVariables
+ *
+ * Show list of available variables (options).
  */
 void
-help_variables(unsigned short int pager)
+helpVariables(unsigned short int pager)
 {
 	FILE	   *output;
 
@@ -335,7 +337,7 @@ help_variables(unsigned short int pager)
 	fprintf(output, _("  USER               the currently connected database user\n"));
 	fprintf(output, _("  VERBOSITY          control verbosity of error reports [default, verbose, terse]\n"));
 
-	fprintf(output, _("\nPrinting options:\n"));
+	fprintf(output, _("\nDisplay influencing variables:\n"));
 	fprintf(output, _("Usage:\n"));
 	fprintf(output, _("  psql --pset=NAME[=VALUE]\n  or \\pset NAME [VALUE] in interactive mode\n\n"));
 
diff --git a/src/bin/psql/help.h b/src/bin/psql/help.h
index bab360d..3ad374a 100644
--- a/src/bin/psql/help.h
+++ b/src/bin/psql/help.h
@@ -12,7 +12,7 @@ void		usage(unsigned short int pager);
 
 void		slashUsage(unsigned short int pager);
 
-void		help_variables(unsigned short int pager);
+void		helpVariables(unsigned short int pager);
 
 void		helpSQL(const char *topic, unsigned short int pager);
 
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index af68e13..0651588 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -574,7 +574,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
 				}
 				break;
 			case 1:
-				help_variables(NOPAGER);
+				helpVariables(NOPAGER);
 				exit(EXIT_SUCCESS);
 			default:
 				fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 7a94fa8..da1b984 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3516,7 +3516,7 @@ psql_completion(const char *text, int start, int end)
 	else if (strcmp(prev_wd, "\\?") == 0)
 	{
 		static const char *const my_list[] =
-		{"options", "variables", NULL};
+		{"commands","options", "variables", NULL};
 
 		COMPLETE_WITH_LIST_CS(my_list);
 	}
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to