diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2013-03-03 22:17:08 -0500 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2013-03-04 15:17:40 +0000 |
commit | 0ea1f6e98fc84f1c5f66cc6355f6e20582295e81 (patch) | |
tree | 6add782d94206a65350ff6ecd97579dfc64baedf /src/bin/psql/command.c | |
parent | 54d6706ded5c612a7f9b16eb6ddb08f44e24bb70 (diff) |
psql: Let \l accept a pattern
reviewed by Satoshi Nagayasu
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 3be7c442a42..c33f9446b20 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -821,10 +821,22 @@ exec_command(const char *cmd, } /* \l is list databases */ - else if (strcmp(cmd, "l") == 0 || strcmp(cmd, "list") == 0) - success = listAllDbs(false); - else if (strcmp(cmd, "l+") == 0 || strcmp(cmd, "list+") == 0) - success = listAllDbs(true); + else if (strcmp(cmd, "l") == 0 || strcmp(cmd, "list") == 0 || + strcmp(cmd, "l+") == 0 || strcmp(cmd, "list+") == 0) + { + char *pattern; + bool show_verbose; + + pattern = psql_scan_slash_option(scan_state, + OT_NORMAL, NULL, true); + + show_verbose = strchr(cmd, '+') ? true : false; + + success = listAllDbs(pattern, show_verbose); + + if (pattern) + free(pattern); + } /* * large object things |