bruce wrote:
> Greg Sabino Mullane wrote:
> -- Start of PGP signed section.
> > Why not run help when someone enters "help" (or "HELP ME!") on the
> > command line? \? is hardly an easy thing to remember (and some people
> > can't be bothered to actually read the screen...)
> > 
> 
> I have applied this patch (attached) with a few modifications.  First
> you were printing \? help for any string beginning with "help" so
> "helplkjasdf" also printed help --- I don't think we want that.  I
> allowed "help", "help "*, and "help;", so "help select" does work
> (prints \?).  
> 
> I also added \? to the list of \? help options because now someone can
> get to \? without typing \?.
> 
> Shame we can't make \h more prominent in \? output.  I am going to try
> to trim down that top help section, but that will a separate patch
> posting by me.

Ah, I see now we later agreed to have 'help' just output a suggestion to
use \?.  I have expanded on that and removed the mention of the web
site, which seemed odd to be just in the 'help' output. (I added a \h
mention.)

Update patch applied, that also reverses the previous patch.

-- 
  Bruce Momjian  <[EMAIL PROTECTED]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.125
diff -c -c -r1.125 help.c
*** src/bin/psql/help.c	4 Apr 2008 17:42:43 -0000	1.125
--- src/bin/psql/help.c	4 Apr 2008 17:57:18 -0000
***************
*** 188,194 ****
  			ON(pset.timing));
  	fprintf(output, _("  \\unset NAME    unset (delete) internal variable\n"));
  	fprintf(output, _("  \\! [COMMAND]   execute command in shell or start interactive shell\n"));
- 	fprintf(output, _("  \\?             display this help output\n"));
  	fprintf(output, "\n");
  
  	fprintf(output, _("Query Buffer\n"));
--- 188,193 ----
Index: src/bin/psql/mainloop.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.88
diff -c -c -r1.88 mainloop.c
*** src/bin/psql/mainloop.c	4 Apr 2008 17:42:43 -0000	1.88
--- src/bin/psql/mainloop.c	4 Apr 2008 17:57:18 -0000
***************
*** 11,17 ****
  
  #include "command.h"
  #include "common.h"
- #include "help.h"
  #include "input.h"
  #include "settings.h"
  
--- 11,16 ----
***************
*** 172,184 ****
  			continue;
  		}
  
! 		/* A request for help? Be friendly and show them the slash way of doing things */
  		if (pset.cur_cmd_interactive && query_buf->len == 0 &&
  			pg_strncasecmp(line, "help", 4) == 0 &&
  			(line[4] == '\0' || line[4] == ';' || isspace(line[4])))
  		{
  			free(line);
! 			slashUsage(pset.popt.topt.pager);
  			continue;
  		}
  
--- 171,186 ----
  			continue;
  		}
  
! 		/* A request for help? Be friendly and give them some guidance */
  		if (pset.cur_cmd_interactive && query_buf->len == 0 &&
  			pg_strncasecmp(line, "help", 4) == 0 &&
  			(line[4] == '\0' || line[4] == ';' || isspace(line[4])))
  		{
  			free(line);
! 			puts("You are using psql, the command-line interface to PostgreSQL.");
! 			puts("Enter SQL commands, or type \\? for a list of backslash options.");
! 			puts("Use \\h for SQL command help.");
! 			puts("Use \\q to quit.");
  			continue;
  		}
  
-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Reply via email to