summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2021-12-15 15:48:12 +0100
committerGitHub <noreply@github.com>2021-12-15 15:48:12 +0100
commit8214d9af2d52856d231db3b70241163d9bebab64 (patch)
tree4348db42856a32e9344d751716c46181c1ac1983
parentd74a33b69f688ed9b8b28033835303604639d4eb (diff)
parentfd17712b84cbb896e7532a20e5f1f691e4c33479 (diff)
downloadconfigshell-fb-8214d9af2d52856d231db3b70241163d9bebab64.tar.gz
Merge pull request #62 from zoumingzhe/master
ConfigShell support passing Console object as parameter
-rw-r--r--configshell/shell.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/configshell/shell.py b/configshell/shell.py
index 437186d..be84b40 100644
--- a/configshell/shell.py
+++ b/configshell/shell.py
@@ -101,7 +101,7 @@ class ConfigShell(object):
_current_token = ''
_current_completions = []
- def __init__(self, preferences_dir=None):
+ def __init__(self, preferences_dir=None, console=None):
'''
Creates a new ConfigShell.
@param preferences_dir: Directory to load/save preferences from/to
@@ -177,7 +177,9 @@ class ConfigShell(object):
if pref not in self.prefs:
self.prefs[pref] = value
- self.con = console.Console()
+ if console is None:
+ console = console.Console()
+ self.con = console
# Private methods