mirror of https://github.com/dbcli/pgcli
Fix a crash caused by leading space.
This commit is contained in:
parent
e20c6b487e
commit
60585c8856
6
TODO
6
TODO
|
@ -1,7 +1,7 @@
|
|||
* [X] Add borders around the table.
|
||||
* [] Investigate why having a space in the beginning of the line breaks everything.
|
||||
* [ ] Investigate why having a space in the beginning of the line breaks everything.
|
||||
* [ ] Add more complex slash commands such as \d <table_name>.
|
||||
* [] Update README.
|
||||
* [ ] Update README.
|
||||
* [] Upload rev 2 to PyPI.
|
||||
* [ ] Add a new trigger for M-/ that does dumb completion.
|
||||
* [ ] Find a way to add documentation to sql commands. This could get tricky.
|
||||
|
@ -16,7 +16,7 @@
|
|||
* [] Create a better framework for adding special commands.
|
||||
* A dict with special commands as keys.
|
||||
* The value can either be a string or a callable.
|
||||
* [] Test if the special comands are autocompleted correctly.
|
||||
* [X] Test if the special comands are autocompleted correctly.
|
||||
* [x] Control smart completion via config file.
|
||||
* [x] Figure out how to deal with transactions.
|
||||
* [X] Add a config file.
|
||||
|
|
|
@ -69,7 +69,8 @@ class PGCompleter(Completer):
|
|||
|
||||
last_token = ''
|
||||
if parsed:
|
||||
last_token = parsed[0].token_prev(len(parsed[0].tokens)).value
|
||||
last_token = parsed[0].token_prev(len(parsed[0].tokens))
|
||||
last_token = last_token.value if last_token else ''
|
||||
|
||||
if last_token.lower() in ('select', 'where', 'having', 'set',
|
||||
'order by', 'group by'):
|
||||
|
|
|
@ -16,6 +16,7 @@ class PGExecute(object):
|
|||
self.conn.autocommit = True
|
||||
|
||||
def run(self, sql):
|
||||
sql = sql.strip()
|
||||
with self.conn.cursor() as cur:
|
||||
if sql in self.special_commands:
|
||||
cur.execute(self.special_commands[sql])
|
||||
|
|
Loading…
Reference in New Issue