Skip to content

Commit c112757

Browse files
authored
Fixes issue where global parameters cannot be set in command line mode
2 parents 01156b4 + c74eb8a commit c112757

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

configshell/shell.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,15 @@ def __init__(self, preferences_dir=None):
163163
self.prefs = prefs.Prefs(str(self._prefs_file))
164164
self._cmd_history = preferences_dir_path / 'history.txt'
165165
self._save_history = True
166-
cmd_history_path = self._cmd_history
167166

168-
if not cmd_history_path.is_file():
169-
try:
170-
with cmd_history_path.open('w'):
171-
pass
172-
except OSError:
173-
self.log.warning(f"Cannot create history file {self._cmd_history}, "
174-
f"command history will not be saved.")
175-
self._save_history = False
167+
if not self._cmd_history.is_file():
168+
try:
169+
with self._cmd_history.open('w'):
170+
pass
171+
except OSError:
172+
self.log.warning(f"Cannot create history file {self._cmd_history}, "
173+
f"command history will not be saved.")
174+
self._save_history = False
176175

177176
if self._cmd_history.is_file() and tty and self._save_history:
178177
try:
@@ -186,7 +185,7 @@ def __init__(self, preferences_dir=None):
186185
log_file_path = preferences_dir_path / 'log.txt'
187186
self.prefs['logfile'] = str(log_file_path)
188187

189-
self.prefs.autosave = True
188+
self.prefs.autosave = True
190189

191190
else:
192191
self.prefs = prefs.Prefs()
@@ -204,7 +203,6 @@ def __init__(self, preferences_dir=None):
204203
self.con = console.Console()
205204

206205
# Private methods
207-
208206
def _display_completions(self, substitution, matches, max_length): # noqa: ARG002 TODO
209207
'''
210208
Display the completions. Invoked by readline.

0 commit comments

Comments
 (0)