Skip to content

Commit b0a41f5

Browse files
authored
Merge pull request #207 from dhashe/history-file-config
Make history file configurable
2 parents 5be771e + 8f6e41e commit b0a41f5

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## TBD
2+
3+
### Features
4+
5+
* Make the history file location configurable. ([#206](https://github.com/dbcli/litecli/issues/206))
6+
17
## 1.14.4 - 2025-01-31
28

39
### Bug Fixes

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)