Tweaking tab completion for some backslash commands

Started by Masahiko Sawadaover 8 years ago3 messages
#1Masahiko Sawada
sawada.mshk@gmail.com
1 attachment(s)

Hi,

While using psql, I found that tab completion for subscription and
publication baskslash commands are not supported. After investigated
other backslash command that is not supported, I found \if, \elif,
\else, \endif and \?.
Attached patch tweaks tab completion for some backslash commands.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachments:

tweak_tab_completion_for_backslash_command.patchapplication/octet-stream; name=tweak_tab_completion_for_backslash_command.patchDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 2abd087..9258739 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -1426,14 +1426,15 @@ psql_completion(const char *text, int start, int end)
 		"\\d", "\\da", "\\dA", "\\db", "\\dc", "\\dC", "\\dd", "\\ddp", "\\dD",
 		"\\des", "\\det", "\\deu", "\\dew", "\\dE", "\\df",
 		"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL",
-		"\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\drds", "\\ds", "\\dS",
-		"\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dy",
-		"\\e", "\\echo", "\\ef", "\\encoding", "\\errverbose", "\\ev",
+		"\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\drds", "\\dRs", "\\dRp", "\\ds",
+		"\\dS", "\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dy",
+		"\\e", "\\echo", "\\ef", "\\elif", "\\else", "\\encoding", "\\endif",
+		"\\errverbose", "\\ev",
 		"\\f", "\\g", "\\gexec", "\\gset", "\\gx", "\\h", "\\help", "\\H",
-		"\\i", "\\ir", "\\l", "\\lo_import", "\\lo_export", "\\lo_list",
+		"\\i", "\\if", "\\ir", "\\l", "\\lo_import", "\\lo_export", "\\lo_list",
 		"\\lo_unlink", "\\o", "\\p", "\\password", "\\prompt", "\\pset", "\\q",
 		"\\qecho", "\\r", "\\s", "\\set", "\\setenv", "\\sf", "\\sv", "\\t",
-		"\\T", "\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!",
+		"\\T", "\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!", "\\?",
 		NULL
 	};
 
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Masahiko Sawada (#1)
Re: Tweaking tab completion for some backslash commands

Masahiko Sawada <sawada.mshk@gmail.com> writes:

Attached patch tweaks tab completion for some backslash commands.

Pushed, thanks!

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Masahiko Sawada
sawada.mshk@gmail.com
In reply to: Tom Lane (#2)
Re: Tweaking tab completion for some backslash commands

On Sun, Jun 4, 2017 at 6:10 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Masahiko Sawada <sawada.mshk@gmail.com> writes:

Attached patch tweaks tab completion for some backslash commands.

Pushed, thanks!

Thank you!

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers