Skip to content

Commit e616cca

Browse files
committed
move REPL execution paths to main_modes/repl.py
Motivation: move code out of the monolithic main.py into logical layers. There is no functional change for this refactor, just the creation of main_modes/repl.py and the migration of (some of) the REPL logic out of main.py. There is much more to do, just in relation to the REPL. For example, complete_while_typing_filter() doesn't logically still belong in main.py, but it is bound up with state set in main.py. Likewise, the updates of the prompt string, and similar updates of window title and toolbar, logically belong with the REPL, but are a bit interwoven with other code in main.py. Another desirable change might be migrating the handlers in key_binding_utils.py to repl.py or some new file repl_handlers.py. We might also consider now removing sections of the relatively brittle tests in test_main_regression.py which relate to the REPL, and a note is left to that effect. run_cli() is left in place for now, but the intention is to fully replace it with main_repl().
1 parent deada76 commit e616cca

File tree

8 files changed

+1620
-690
lines changed

8 files changed

+1620
-690
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Internal
3939
* Move `--execute` logic to the new `main_modes` with `--batch`.
4040
* Move `--list-dsn` logic to the new `main_modes` with `--batch`.
4141
* Move `--list-ssh-config` logic to the new `main_modes` with `--batch`.
42+
* Move REPL logic to the new `main_modes`.
4243
* Sort coverage report in tox suite.
4344
* Skip more tests when a database connection is not present.
4445
* Move SQL utilities to a new `sql_utils.py`.

mycli/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
DEFAULT_USER = 'root'
1111

1212
TEST_DATABASE = 'mycli_test_db'
13+
14+
DEFAULT_WIDTH = 80
15+
DEFAULT_HEIGHT = 25

mycli/main.py

Lines changed: 12 additions & 509 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)