Add help & tab-complete support for psql's \getenv.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 21 Dec 2021 21:18:41 +0000 (16:18 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 21 Dec 2021 21:18:41 +0000 (16:18 -0500)
I forgot about these details in 33d3eeadb :-(.
Noted by Christoph Berg.

Discussion: https://postgr.es/m/YcI8i/mduMi91uXY@msg.df7cb.de

src/bin/psql/help.c
src/bin/psql/tab-complete.c

index db12a8b2f3338603202127bc59330cc10445a642..8cadfbb1032aade4409090f89a7a6afee05cb380 100644 (file)
@@ -166,7 +166,7 @@ slashUsage(unsigned short int pager)
         * Use "psql --help=commands | wc" to count correctly.  It's okay to count
         * the USE_READLINE line even in builds without that.
         */
-       output = PageOutput(136, pager ? &(pset.popt.topt) : NULL);
+       output = PageOutput(137, pager ? &(pset.popt.topt) : NULL);
 
        fprintf(output, _("General\n"));
        fprintf(output, _("  \\copyright             show PostgreSQL usage and distribution terms\n"));
@@ -309,6 +309,7 @@ slashUsage(unsigned short int pager)
 
        fprintf(output, _("Operating System\n"));
        fprintf(output, _("  \\cd [DIR]              change the current working directory\n"));
+       fprintf(output, _("  \\getenv PSQLVAR ENVVAR fetch environment variable\n"));
        fprintf(output, _("  \\setenv NAME [VALUE]   set or unset environment variable\n"));
        fprintf(output, _("  \\timing [on|off]       toggle timing of commands (currently %s)\n"),
                        ON(pset.timing));
index b524dc87fc18100609713e8002469d0a9c02c475..cf30239f6dbc7c02e22bd664af191d0c822c368c 100644 (file)
@@ -1519,7 +1519,7 @@ psql_completion(const char *text, int start, int end)
                "\\echo", "\\edit", "\\ef", "\\elif", "\\else", "\\encoding",
                "\\endif", "\\errverbose", "\\ev",
                "\\f",
-               "\\g", "\\gdesc", "\\gexec", "\\gset", "\\gx",
+               "\\g", "\\gdesc", "\\getenv", "\\gexec", "\\gset", "\\gx",
                "\\help", "\\html",
                "\\if", "\\include", "\\include_relative", "\\ir",
                "\\list", "\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",