Skip to content

Commit 721dd19

Browse files
committed
Reorder psql \? help into groupings, idea from Harald Armin Massa.
1 parent dc8d322 commit 721dd19

File tree

1 file changed

+49
-31
lines changed

1 file changed

+49
-31
lines changed

src/bin/psql/help.c

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.63 2002/12/11 04:09:51 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.64 2002/12/11 22:45:13 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "common.h"
@@ -171,14 +171,34 @@ slashUsage(unsigned short int pager)
171171
* if this " is the start of the string then it ought to end there to
172172
* fit in 80 columns >> "
173173
*/
174-
fprintf(output, _(" \\a toggle between unaligned and aligned output mode\n"));
174+
fprintf(output, _("General\n"));
175175
fprintf(output, _(" \\c[onnect] [DBNAME|- [USER]]\n"
176176
" connect to new database (currently \"%s\")\n"),
177177
PQdb(pset.db));
178-
fprintf(output, _(" \\C [STRING] set table title, or unset if none\n"));
179-
fprintf(output, _(" \\cd [DIR] change the current working directory\n"));
180-
fprintf(output, _(" \\copy ... perform SQL COPY with data stream to the client host\n"));
178+
fprintf(output, _(" \\q quit psql\n"));
179+
fprintf(output, _(" \\h [NAME] help on syntax of SQL commands, * for all commands\n"));
181180
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
181+
fprintf(output, _(" \\cd [DIR] change the current working directory\n"));
182+
fprintf(output, _(" \\! [COMMAND] execute command in shell or start interactive shell\n"));
183+
fprintf(output, _(" \\encoding [ENCODING] show or set client encoding\n"));
184+
fprintf(output, _(" \\set [NAME [VALUE]] set internal variable, or list all if no parameters\n"));
185+
fprintf(output, _(" \\unset NAME unset (delete) internal variable\n"));
186+
fprintf(output, _(" \\timing toggle timing of commands (currently %s)\n"),
187+
ON(pset.timing));
188+
fprintf(output, _("\n"));
189+
190+
fprintf(output, _("Query Buffer\n"));
191+
fprintf(output, _(" \\g [FILE] send query buffer to server (and results to file or |pipe)\n"));
192+
fprintf(output, _(" \\r reset (clear) the query buffer\n"));
193+
fprintf(output, _(" \\e [FILE] edit the query buffer (or file) with external editor\n"));
194+
fprintf(output, _(" \\i FILE execute commands from file\n"));
195+
fprintf(output, _(" \\p show the contents of the query buffer\n"));
196+
fprintf(output, _(" \\w [FILE] write query buffer to file\n"));
197+
fprintf(output, _(" \\o FILE send all query results to file or |pipe\n"));
198+
fprintf(output, _(" \\s [FILE] display history or save it to file\n"));
199+
fprintf(output, _("\n"));
200+
201+
fprintf(output, _("Informational\n"));
182202
fprintf(output, _(" \\d [NAME] describe table, index, sequence, or view\n"));
183203
fprintf(output, _(" \\d{t|i|s|v|S} [PATTERN] (add \"+\" for more detail)\n"
184204
" list tables/indexes/sequences/views/system tables\n"));
@@ -191,39 +211,37 @@ slashUsage(unsigned short int pager)
191211
fprintf(output, _(" \\dp [PATTERN] list table access privileges\n"));
192212
fprintf(output, _(" \\dT [PATTERN] list data types (add \"+\" for more detail)\n"));
193213
fprintf(output, _(" \\du [PATTERN] list users\n"));
194-
fprintf(output, _(" \\e [FILE] edit the query buffer (or file) with external editor\n"));
195-
fprintf(output, _(" \\echo [STRING] write string to standard output\n"));
196-
fprintf(output, _(" \\encoding [ENCODING] show or set client encoding\n"));
214+
fprintf(output, _(" \\l list all databases (add \"+\" for more detail)\n"));
215+
fprintf(output, _(" \\z [PATTERN] list table access privileges (same as \\dp)\n"));
216+
fprintf(output, _("\n"));
217+
218+
fprintf(output, _("Large Object, Copy\n"));
219+
fprintf(output, _(" \\lo_export\n"));
220+
fprintf(output, _(" \\lo_import\n"));
221+
fprintf(output, _(" \\lo_list\n"));
222+
fprintf(output, _(" \\lo_unlink large object operations\n"));
223+
fprintf(output, _(" \\copy ... perform SQL COPY with data stream to the client host\n"));
224+
fprintf(output, _("\n"));
225+
226+
fprintf(output, _("Formatting\n"));
227+
fprintf(output, _(" \\x toggle expanded output (currently %s)\n"),
228+
ON(pset.popt.topt.expanded));
229+
fprintf(output, _(" \\a toggle between unaligned and aligned output mode\n"));
197230
fprintf(output, _(" \\f [STRING] show or set field separator for unaligned query output\n"));
198-
fprintf(output, _(" \\g [FILE] send query buffer to server (and results to file or |pipe)\n"));
199-
fprintf(output, _(" \\h [NAME] help on syntax of SQL commands, * for all commands\n"));
200-
fprintf(output, _(" \\H toggle HTML output mode (currently %s)\n"),
201-
ON(pset.popt.topt.format == PRINT_HTML));
202-
fprintf(output, _(" \\i FILE execute commands from file\n"));
203-
fprintf(output, _(" \\l list all databases\n"));
204-
fprintf(output, _(" \\lo_export, \\lo_import, \\lo_list, \\lo_unlink\n"
205-
" large object operations\n"));
206-
fprintf(output, _(" \\o FILE send all query results to file or |pipe\n"));
207-
fprintf(output, _(" \\p show the contents of the query buffer\n"));
208231
fprintf(output, _(" \\pset NAME [VALUE] set table output option\n"
209232
" (NAME := {format|border|expanded|fieldsep|null|recordsep|\n"
210233
" tuples_only|title|tableattr|pager})\n"));
211-
fprintf(output, _(" \\q quit psql\n"));
212-
fprintf(output, _(" \\qecho [STRING] write string to query output stream (see \\o)\n"));
213-
fprintf(output, _(" \\r reset (clear) the query buffer\n"));
214-
fprintf(output, _(" \\s [FILE] display history or save it to file\n"));
215-
fprintf(output, _(" \\set [NAME [VALUE]] set internal variable, or list all if no parameters\n"));
234+
fprintf(output, _(" \\C [STRING] set table title, or unset if none\n"));
216235
fprintf(output, _(" \\t show only rows (currently %s)\n"),
217236
ON(pset.popt.topt.tuples_only));
237+
fprintf(output, _(" \\echo [STRING] write string to standard output\n"));
238+
fprintf(output, _(" \\qecho [STRING] write string to query output stream (see \\o)\n"));
239+
fprintf(output, _("\n"));
240+
241+
fprintf(output, _("HTML Output\n"));
242+
fprintf(output, _(" \\H toggle HTML output mode (currently %s)\n"),
243+
ON(pset.popt.topt.format == PRINT_HTML));
218244
fprintf(output, _(" \\T [STRING] set HTML <table> tag attributes, or unset if none\n"));
219-
fprintf(output, _(" \\timing toggle timing of commands (currently %s)\n"),
220-
ON(pset.timing));
221-
fprintf(output, _(" \\unset NAME unset (delete) internal variable\n"));
222-
fprintf(output, _(" \\w [FILE] write query buffer to file\n"));
223-
fprintf(output, _(" \\x toggle expanded output (currently %s)\n"),
224-
ON(pset.popt.topt.expanded));
225-
fprintf(output, _(" \\z [PATTERN] list table access privileges (same as \\dp)\n"));
226-
fprintf(output, _(" \\! [COMMAND] execute command in shell or start interactive shell\n"));
227245

228246
if (output != stdout)
229247
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy