Skip to content

Commit 78c9eed

Browse files
committed
Server(fix[show_prompt_history,clear_prompt_history]): guard tmux 3.3+
why: Both commands were added in tmux 3.3 but libtmux supports 3.2a. Without a guard, callers on 3.2a get a raw "unknown command" tmux error instead of a clean LibTmuxException with version context. what: - Add has_gte_version("3.3") guard to show_prompt_history - Add has_gte_version("3.3") guard to clear_prompt_history - Pattern matches confirm_before / command_prompt guards in same file
1 parent ec2c696 commit 78c9eed

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libtmux/server.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,12 @@ def show_prompt_history(
11411141
>>> isinstance(result, list)
11421142
True
11431143
"""
1144+
from libtmux.common import has_gte_version
1145+
1146+
if not has_gte_version("3.3", tmux_bin=self.tmux_bin):
1147+
msg = "show_prompt_history requires tmux 3.3+"
1148+
raise exc.LibTmuxException(msg)
1149+
11441150
tmux_args: tuple[str, ...] = ()
11451151

11461152
if prompt_type is not None:
@@ -1170,6 +1176,12 @@ def clear_prompt_history(
11701176
--------
11711177
>>> server.clear_prompt_history()
11721178
"""
1179+
from libtmux.common import has_gte_version
1180+
1181+
if not has_gte_version("3.3", tmux_bin=self.tmux_bin):
1182+
msg = "clear_prompt_history requires tmux 3.3+"
1183+
raise exc.LibTmuxException(msg)
1184+
11731185
tmux_args: tuple[str, ...] = ()
11741186

11751187
if prompt_type is not None:

0 commit comments

Comments
 (0)