Skip to content

Commit b10f93b

Browse files
committed
Make history file location configurable
This matches the behavior of pgcli and mssql-cli.
1 parent 5be771e commit b10f93b

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

litecli/liteclirc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ destructive_warning = True
1818
# %USERPROFILE% is typically C:\Users\{username}
1919
log_file = default
2020

21+
# history_file location.
22+
# In Unix/Linux: ~/.config/litecli/history
23+
# In Windows: %USERPROFILE%\AppData\Local\dbcli\litecli\history
24+
# %USERPROFILE% is typically C:\Users\{username}
25+
history_file = default
26+
2127
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
2228
# and "DEBUG". "NONE" disables logging.
2329
log_level = INFO

litecli/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ def run_cli(self):
352352
self.configure_pager()
353353
self.refresh_completions()
354354

355-
history_file = config_location() + "history"
355+
history_file = self.config["main"]["history_file"]
356+
if history_file == "default":
357+
history_file = config_location() + "history"
358+
history_file = os.path.expanduser(history_file)
356359
if dir_path_exists(history_file):
357360
history = FileHistory(history_file)
358361
else:

0 commit comments

Comments
 (0)