From 469822866bf8df36b5042138777f89779e20b78e Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 17 Jan 2026 09:04:23 -0500 Subject: [PATCH] allow history file location to be configured --- changelog.md | 4 ++++ mycli/main.py | 2 +- mycli/myclirc | 3 +++ test/myclirc | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 7f5a6cef..3a4a7451 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,10 @@ TBD ============== +Features +-------- +* Allow history file location to be configured. + Bug Fixes -------- * Respect `--logfile` when using `--execute` or standard input at the shell CLI. diff --git a/mycli/main.py b/mycli/main.py index d0bca605..0b240c73 100755 --- a/mycli/main.py +++ b/mycli/main.py @@ -772,7 +772,7 @@ def run_cli(self) -> None: if self.smart_completion: self.refresh_completions() - history_file = os.path.expanduser(os.environ.get("MYCLI_HISTFILE", "~/.mycli-history")) + history_file = os.path.expanduser(os.environ.get("MYCLI_HISTFILE", self.config.get("history_file", "~/.mycli-history"))) if dir_path_exists(history_file): history = FileHistoryWithTimestamp(history_file) else: diff --git a/mycli/myclirc b/mycli/myclirc index 62353c9e..b49b81a6 100644 --- a/mycli/myclirc +++ b/mycli/myclirc @@ -27,6 +27,9 @@ multi_line = False # or "shutdown". destructive_warning = True +# interactive query history location. +history_file = ~/.mycli-history + # log_file location. log_file = ~/.mycli.log diff --git a/test/myclirc b/test/myclirc index f4f0ff09..5f3c5a01 100644 --- a/test/myclirc +++ b/test/myclirc @@ -27,6 +27,9 @@ multi_line = False # or "shutdown". destructive_warning = True +# interactive query history location. +history_file = ~/.mycli-history + # log_file location. log_file = ~/.mycli.test.log