summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIryna Cherniavska <i.chernyavska@gmail.com>2014-12-29 14:15:23 -0800
committerIryna Cherniavska <i.chernyavska@gmail.com>2014-12-29 14:15:23 -0800
commit96b6441bd892e516aed85be6511a731b5299998e (patch)
tree860c0f157b920051ba6ac1ae3da6b8a7fa9f3c1f
parente9868b7d98de19672b0737bb69287b1f450a5417 (diff)
Set multi-line via config file.
-rw-r--r--TODO2
-rwxr-xr-xpgcli/main.py3
-rw-r--r--pgcli/pgclirc1
3 files changed, 4 insertions, 2 deletions
diff --git a/TODO b/TODO
index 733fd718..4e515a7d 100644
--- a/TODO
+++ b/TODO
@@ -14,7 +14,7 @@
* [ ] Find a way to add documentation to sql commands. This could get tricky.
* [ ] Refactor the execution and output into a separate class.
* [ ] Create a class for the config and make it easy to access.
-* [ ] Set multi-line via config file.
+* [X] Set multi-line via config file.
* [ ] New Feature List - Write the current version to config file. At launch if the version has changed, display the changelog between the two versions.
* [X] Separate the column completions to be table specific. (SELECT, INSERT, UPDATE)
* [X] Fix: Autocompletion won't go away after semi-colons. This an artifact of stripping special chars in the partially typed words. Need to selectively remove parens.
diff --git a/pgcli/main.py b/pgcli/main.py
index 5dab1403..eed43e38 100755
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -52,6 +52,7 @@ def cli(database, user, password, host, port):
# Load config.
config = load_config('~/.pgclirc')
smart_completion = config.getboolean('main', 'smart_completion')
+ multi_line = config.getboolean('main', 'multi_line')
less_opts = os.environ.get('LESS', '')
if not less_opts:
@@ -81,7 +82,7 @@ def cli(database, user, password, host, port):
for table in tables:
completer.extend_column_names(table, pgexecute.columns(table))
completer.extend_database_names(pgexecute.databases())
- line = PGLine(always_multiline=False, completer=completer,
+ line = PGLine(always_multiline=multi_line, completer=completer,
history=FileHistory(os.path.expanduser('~/.pgcli-history')))
cli = CommandLineInterface(style=PGStyle, layout=layout, line=line,
key_binding_factories=[emacs_bindings, pgcli_bindings])
diff --git a/pgcli/pgclirc b/pgcli/pgclirc
index e487f2fb..27b389c1 100644
--- a/pgcli/pgclirc
+++ b/pgcli/pgclirc
@@ -1,2 +1,3 @@
[main]
smart_completion = true
+multi_line = False \ No newline at end of file