Commit 92fc8b41 authored by Peter Eisentraut's avatar Peter Eisentraut

Add the long options to the psql --help display, where they were curiously

missing.

Since this touches most lines of the help output, also change the mix of
puts and printf calls to printf everywhere, for easier code editing and
reviewing.
parent b6e4c8f2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2000-2009, PostgreSQL Global Development Group * Copyright (c) 2000-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.140 2009/02/26 16:02:38 petere Exp $ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.141 2009/02/27 09:58:09 petere Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -83,71 +83,72 @@ usage(void) ...@@ -83,71 +83,72 @@ usage(void)
#endif /* WIN32 */ #endif /* WIN32 */
} }
/* >>> If this " is the start of the string then it ought to end there to fit in 80 columns >> " */ printf(_("psql is the PostgreSQL interactive terminal.\n\n"));
printf(_("This is psql %s, the PostgreSQL interactive terminal.\n\n"), printf(_("Usage:\n"));
PG_VERSION); printf(_(" psql [OPTIONS]... [DBNAME [USERNAME]]\n\n"));
puts(_("Usage:"));
puts(_(" psql [OPTIONS]... [DBNAME [USERNAME]]\n"));
puts(_("General options:")); printf(_("General options:\n"));
/* Display default database */ /* Display default database */
env = getenv("PGDATABASE"); env = getenv("PGDATABASE");
if (!env) if (!env)
env = user; env = user;
puts(_(" -c COMMAND run only single command (SQL or internal) and exit")); printf(_(" -c, --command=COMMAND run only single command (SQL or internal) and exit\n"));
printf(_(" -d DBNAME database name to connect to (default: \"%s\")\n"), env); printf(_(" -d, --dbnme=DBNAME database name to connect to (default: \"%s\")\n"), env);
puts(_(" -f FILENAME execute commands from file, then exit")); printf(_(" -f, --file=FILENAME execute commands from file, then exit\n"));
puts(_(" -l list available databases, then exit")); printf(_(" -l, --list list available databases, then exit\n"));
puts(_(" -v NAME=VALUE set psql variable NAME to VALUE")); printf(_(" -v, --set=, --variable=NAME=VALUE\n"
puts(_(" -X do not read startup file (~/.psqlrc)")); " set psql variable NAME to VALUE\n"));
puts(_(" -1 (\"one\") execute command file as a single transaction")); printf(_(" -X, --no-psqlrc do not read startup file (~/.psqlrc)\n"));
puts(_(" --help show this help, then exit")); printf(_(" -1 (\"one\"), --single-transaction\n"
puts(_(" --version output version information, then exit")); " execute command file as a single transaction\n"));
printf(_(" --help show this help, then exit\n"));
puts(_("\nInput and output options:")); printf(_(" --version output version information, then exit\n"));
puts(_(" -a echo all input from script"));
puts(_(" -e echo commands sent to server")); printf(_("\nInput and output options:\n"));
puts(_(" -E display queries that internal commands generate")); printf(_(" -a, --echo-all echo all input from script\n"));
puts(_(" -L FILENAME send session log to file")); printf(_(" -e, --echo-queries echo commands sent to server\n"));
puts(_(" -n disable enhanced command line editing (readline)")); printf(_(" -E, --echo-hidden display queries that internal commands generate\n"));
puts(_(" -o FILENAME send query results to file (or |pipe)")); printf(_(" -L, --log-file=FILENAME send session log to file\n"));
puts(_(" -q run quietly (no messages, only query output)")); printf(_(" -n, --no-readline disable enhanced command line editing (readline)\n"));
puts(_(" -s single-step mode (confirm each query)")); printf(_(" -o, --output=FILENAME send query results to file (or |pipe)\n"));
puts(_(" -S single-line mode (end of line terminates SQL command)")); printf(_(" -q, --quiet run quietly (no messages, only query output)\n"));
printf(_(" -s, --single-step single-step mode (confirm each query)\n"));
puts(_("\nOutput format options:")); printf(_(" -S, --single-line single-line mode (end of line terminates SQL command)\n"));
puts(_(" -A unaligned table output mode (-P format=unaligned)"));
printf(_(" -F STRING set field separator (default: \"%s\") (-P fieldsep=)\n"), printf(_("\nOutput format options:\n"));
printf(_(" -A, --no-align unaligned table output mode\n"));
printf(_(" -F, --field-separator=STRING\n"
" set field separator (default: \"%s\")\n"),
DEFAULT_FIELD_SEP); DEFAULT_FIELD_SEP);
puts(_(" -H HTML table output mode (-P format=html)")); printf(_(" -H, --html HTML table output mode\n"));
puts(_(" -P VAR[=ARG] set printing option VAR to ARG (see \\pset command)")); printf(_(" -P, --pset=VAR[=ARG] set printing option VAR to ARG (see \\pset command)\n"));
puts(_(" -R STRING set record separator (default: newline) (-P recordsep=)")); printf(_(" -R, --record-separator=STRING\n"
puts(_(" -t print rows only (-P tuples_only)")); " set record separator (default: newline)\n"));
puts(_(" -T TEXT set HTML table tag attributes (width, border) (-P tableattr=)")); printf(_(" -t, --tuples-only print rows only\n"));
puts(_(" -x turn on expanded table output (-P expanded)")); printf(_(" -T, --table-attr=TEXT set HTML table tag attributes (e.g., width, border)\n"));
printf(_(" -x, --expanded turn on expanded table output\n"));
puts(_("\nConnection options:"));
printf(_("\nConnection options:\n"));
/* Display default host */ /* Display default host */
env = getenv("PGHOST"); env = getenv("PGHOST");
printf(_(" -h HOSTNAME database server host or socket directory (default: \"%s\")\n"), printf(_(" -h, --host=HOSTNAME database server host or socket directory (default: \"%s\")\n"),
env ? env : _("local socket")); env ? env : _("local socket"));
/* Display default port */ /* Display default port */
env = getenv("PGPORT"); env = getenv("PGPORT");
printf(_(" -p PORT database server port (default: \"%s\")\n"), printf(_(" -p, --port=PORT database server port (default: \"%s\")\n"),
env ? env : DEF_PGPORT_STR); env ? env : DEF_PGPORT_STR);
/* Display default user */ /* Display default user */
env = getenv("PGUSER"); env = getenv("PGUSER");
if (!env) if (!env)
env = user; env = user;
printf(_(" -U NAME database user name (default: \"%s\")\n"), env); printf(_(" -U, --username=USERNAME database user name (default: \"%s\")\n"), env);
puts(_(" -w never prompt for password")); printf(_(" -w, --no-password never prompt for password\n"));
puts(_(" -W force password prompt (should happen automatically)")); printf(_(" -W, --password force password prompt (should happen automatically)\n"));
puts(_( printf(_("\nFor more information, type \"\\?\" (for internal commands) or \"\\help\" (for SQL\n"
"\nFor more information, type \"\\?\" (for internal commands) or \"\\help\"\n" "commands) from within psql, or consult the psql section in the PostgreSQL\n"
"(for SQL commands) from within psql, or consult the psql section in\n" "documentation.\n\n"));
"the PostgreSQL documentation.\n\n" printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
"Report bugs to <pgsql-bugs@postgresql.org>."));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment