diff options
author | Darik Gamble <darik.gamble@gmail.com> | 2015-02-27 10:06:44 -0500 |
---|---|---|
committer | Darik Gamble <darik.gamble@gmail.com> | 2015-02-27 10:06:44 -0500 |
commit | 687578eafbe18b8538f23ff951207e5c15efae0c (patch) | |
tree | a907cefa9032c317dbfaf7e56f04ba5603c9c350 | |
parent | 5d44904aa3f7d25c0eba2ae2893d966fa64a0598 (diff) |
\dn suggests schemas only
-rw-r--r-- | pgcli/packages/sqlcompletion.py | 3 | ||||
-rw-r--r-- | tests/test_pgspecial.py | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/pgcli/packages/sqlcompletion.py b/pgcli/packages/sqlcompletion.py index 91bd616d..b4379437 100644 --- a/pgcli/packages/sqlcompletion.py +++ b/pgcli/packages/sqlcompletion.py @@ -86,6 +86,9 @@ def suggest_special(text): if cmd == '\\c': return [{'type': 'database'}] + if cmd == '\\dn': + return [{'type': 'schema'}] + if arg: # Try to distinguish "\d name" from "\d schema.name" # Note that this will fail to obtain a schema name if wildcards are diff --git a/tests/test_pgspecial.py b/tests/test_pgspecial.py index e16631a2..39f9f979 100644 --- a/tests/test_pgspecial.py +++ b/tests/test_pgspecial.py @@ -11,6 +11,14 @@ def test_slash_d_suggests_special(): assert sorted_dicts(suggestions) == sorted_dicts( [{'type': 'special'}]) +def test_dn_suggests_schemata(): + suggestions = suggest_type('\\dn ', '\\dn ') + assert suggestions == [{'type': 'schema'}] + + suggestions = suggest_type('\\dn xxx', '\\dn xxx') + assert suggestions == [{'type': 'schema'}] + + def test_d_suggests_tables_and_schemas(): suggestions = suggest_type('\d ', '\d ') assert sorted_dicts(suggestions) == sorted_dicts([ |