diff options
author | Peter Eisentraut | 2019-03-11 07:50:02 +0000 |
---|---|---|
committer | Peter Eisentraut | 2019-03-11 08:11:37 +0000 |
commit | 27f3dea64833d68c1fa08c1e5d26176a579f69c8 (patch) | |
tree | 82a089f449617448832baddbd7bfdf6e77be8451 /src/bin/psql/help.c | |
parent | f2d84a4a6b4ec891a0a52f583ed5aa081c71acc6 (diff) |
psql: Add documentation URL to \help output
Add a link to the specific command's reference web page to the bottom
of its \help output.
Discussion: https://www.postgresql.org/message-id/flat/40179bd0-fa7d-4108-1991-a20ae9ad5667%402ndquadrant.com
Diffstat (limited to 'src/bin/psql/help.c')
-rw-r--r-- | src/bin/psql/help.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 6bac9e47fd7..6fc4ebab1e8 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -623,16 +623,23 @@ helpSQL(const char *topic, unsigned short int pager) strcmp(topic, "*") == 0) { PQExpBufferData buffer; + char *url; initPQExpBuffer(&buffer); QL_HELP[i].syntaxfunc(&buffer); help_found = true; + url = psprintf("https://www.postgresql.org/docs/%s/%s.html", + strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION, + QL_HELP[i].docbook_id); fprintf(output, _("Command: %s\n" "Description: %s\n" - "Syntax:\n%s\n\n"), + "Syntax:\n%s\n\n" + "URL: %s\n\n"), QL_HELP[i].cmd, _(QL_HELP[i].help), - buffer.data); + buffer.data, + url); + free(url); /* If we have an exact match, exit. Fixes \h SELECT */ if (pg_strcasecmp(topic, QL_HELP[i].cmd) == 0) break; |