diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d079b6..26465c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## TBD + +### Features + +* Make the history file location configurable. ([#206](https://github.com/dbcli/litecli/issues/206)) + ## 1.14.4 - 2025-01-31 ### Bug Fixes diff --git a/litecli/liteclirc b/litecli/liteclirc index 1184278..0a1a504 100644 --- a/litecli/liteclirc +++ b/litecli/liteclirc @@ -18,6 +18,12 @@ destructive_warning = True # %USERPROFILE% is typically C:\Users\{username} log_file = default +# history_file location. +# In Unix/Linux: ~/.config/litecli/history +# In Windows: %USERPROFILE%\AppData\Local\dbcli\litecli\history +# %USERPROFILE% is typically C:\Users\{username} +history_file = default + # Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO" # and "DEBUG". "NONE" disables logging. log_level = INFO diff --git a/litecli/main.py b/litecli/main.py index 1f3f442..8895980 100644 --- a/litecli/main.py +++ b/litecli/main.py @@ -352,7 +352,10 @@ def run_cli(self): self.configure_pager() self.refresh_completions() - history_file = config_location() + "history" + history_file = self.config["main"]["history_file"] + if history_file == "default": + history_file = config_location() + "history" + history_file = os.path.expanduser(history_file) if dir_path_exists(history_file): history = FileHistory(history_file) else: