Skip to content

Commit 0f2abd0

Browse files
committed
Add help & tab-complete support for psql's \getenv.
I forgot about these details in 33d3eea :-(. Noted by Christoph Berg. Discussion: https://postgr.es/m/YcI8i/mduMi91uXY@msg.df7cb.de
1 parent 1fada5d commit 0f2abd0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/bin/psql/help.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ slashUsage(unsigned short int pager)
166166
* Use "psql --help=commands | wc" to count correctly. It's okay to count
167167
* the USE_READLINE line even in builds without that.
168168
*/
169-
output = PageOutput(136, pager ? &(pset.popt.topt) : NULL);
169+
output = PageOutput(137, pager ? &(pset.popt.topt) : NULL);
170170

171171
fprintf(output, _("General\n"));
172172
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
@@ -309,6 +309,7 @@ slashUsage(unsigned short int pager)
309309

310310
fprintf(output, _("Operating System\n"));
311311
fprintf(output, _(" \\cd [DIR] change the current working directory\n"));
312+
fprintf(output, _(" \\getenv PSQLVAR ENVVAR fetch environment variable\n"));
312313
fprintf(output, _(" \\setenv NAME [VALUE] set or unset environment variable\n"));
313314
fprintf(output, _(" \\timing [on|off] toggle timing of commands (currently %s)\n"),
314315
ON(pset.timing));

src/bin/psql/tab-complete.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ psql_completion(const char *text, int start, int end)
15191519
"\\echo", "\\edit", "\\ef", "\\elif", "\\else", "\\encoding",
15201520
"\\endif", "\\errverbose", "\\ev",
15211521
"\\f",
1522-
"\\g", "\\gdesc", "\\gexec", "\\gset", "\\gx",
1522+
"\\g", "\\gdesc", "\\getenv", "\\gexec", "\\gset", "\\gx",
15231523
"\\help", "\\html",
15241524
"\\if", "\\include", "\\include_relative", "\\ir",
15251525
"\\list", "\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",

0 commit comments

Comments
 (0)