From d83fcdf645a3b0a05458a83f67094240aee99bd0 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 21 Feb 2026 08:24:43 -0500 Subject: [PATCH] let prompt changes respect dynamic format strings The interactive "prompt" command was calling get_prompt() to set the prompt format. But get_prompt() computes the substituted values of any format strings. Therefore the interactive "prompt" command was burning in any dynamically-computed values such as the date or the database name as a static value. This is a bug, and it differs from the behavior of setting the prompt option in ~/.myclirc, which works correctly here. The fix is to set the prompt format directly to the argument to change_prompt_format(), because the argument _is_ a format string. --- changelog.md | 14 +++++++++++++- mycli/main.py | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 0126f5bd..9fc4f094 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,16 @@ +Upcoming (TBD) +============== + +Features +--------- +* Add extra error output on connection failure for possible SSL mismatch (#1584). + + +Bug Fixes +--------- +* Let interactive changes to the prompt format respect dynamically-computed values. + + 1.56.0 (2026/02/23) ============== @@ -6,7 +19,6 @@ Features * Let the `--dsn` argument accept literal DSNs as well as aliases. * Accept `--character-set` as an alias for `--charset` at the CLI. * Add SSL/TLS version to `status` output. -* Add extra error output on connection failure for possible SSL mismatch (#1584) * Accept `socket` as a DSN query parameter. * Accept new-style `ssl_mode` in DSN URI query parameters, to match CLI argument. * Fully deprecate the built-in SSH functionality. diff --git a/mycli/main.py b/mycli/main.py index 689c6c1d..a93aa6ba 100755 --- a/mycli/main.py +++ b/mycli/main.py @@ -435,7 +435,7 @@ def change_prompt_format(self, arg: str, **_) -> list[SQLResult]: message = "Missing required argument, format." return [SQLResult(status=message)] - self.prompt_format = self.get_prompt(arg) + self.prompt_format = arg return [SQLResult(status=f"Changed prompt format to {arg}")] def initialize_logging(self) -> None: