Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Patches > Re: Friendly he...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3558 of 4253
Post > Topic >>

Re: Friendly help for psql

by bruce@[EMAIL PROTECTED] (Bruce Momjian) Apr 4, 2008 at 02:00 PM

--ELM1207332054-9832-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"

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  <bruce@[EMAIL PROTECTED]
>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

--ELM1207332054-9832-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff
Content-Disposition: inline; filename="/rtmp/diff"

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;
  		}
  

--ELM1207332054-9832-0_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

--ELM1207332054-9832-0_--
 




 1 Posts in Topic:
Re: Friendly help for psql
bruce@[EMAIL PROTECTED]   2008-04-04 14:00:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 5:27:43 CST 2008.