Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Upcoming (TBD)
==============

Features
---------
* Add prompt format string for literal backslash.


1.64.0 (2026/03/13)
==============

Expand Down
3 changes: 3 additions & 0 deletions mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,8 @@ def get_prompt(self, string: str, _render_counter: int) -> str:
if re.match(r'^[\d\.]+$', short_prompt_host):
short_prompt_host = prompt_host
now = datetime.now()
backslash_placeholder = '\ufffc_backslash'
string = string.replace('\\\\', backslash_placeholder)
string = string.replace("\\u", sqlexecute.user or "(none)")
string = string.replace("\\h", prompt_host or "(none)")
string = string.replace("\\H", short_prompt_host or "(none)")
Expand All @@ -1721,6 +1723,7 @@ def get_prompt(self, string: str, _render_counter: int) -> str:
string = string.replace("\\K", sqlexecute.socket or str(sqlexecute.port))
string = string.replace("\\A", self.dsn_alias or "(none)")
string = string.replace("\\_", " ")
string = string.replace(backslash_placeholder, '\\')

# jump through hoops for the test environment, and for efficiency
if hasattr(sqlexecute, 'conn') and sqlexecute.conn is not None:
Expand Down
1 change: 1 addition & 0 deletions mycli/myclirc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ wider_completion_menu = False
# * \A - DSN alias
# * \n - a newline
# * \_ - a space
# * \\ - a literal backslash
# * \x1b[...m - an ANSI escape sequence (can style with color)
prompt = '\t \u@\h:\d> '
prompt_continuation = '->'
Expand Down
1 change: 1 addition & 0 deletions test/myclirc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ wider_completion_menu = False
# * \A - DSN alias
# * \n - a newline
# * \_ - a space
# * \\ - a literal backslash
# * \x1b[...m - an ANSI escape sequence (can style with color)
prompt = "\t \u@\h:\d> "
prompt_continuation = ->
Expand Down
Loading