Skip to content

Commit 864102c

Browse files
committed
refactor!(Window): Deprecate set_window_option -> set_option
1 parent bfefbb9 commit 864102c

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/libtmux/window.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,11 @@ def select_layout(self, layout: str | None = None) -> Window:
436436

437437
return self
438438

439-
def set_window_option(
439+
def set_option(
440440
self,
441441
option: str,
442442
value: int | str,
443-
format: bool | None = None,
443+
_format: bool | None = None,
444444
unset: bool | None = None,
445445
unset_panes: bool | None = None,
446446
prevent_overwrite: bool | None = None,
@@ -479,8 +479,8 @@ def set_window_option(
479479
assert isinstance(unset_panes, bool)
480480
flags.append("-U")
481481

482-
if format is not None and format:
483-
assert isinstance(format, bool)
482+
if _format is not None and _format:
483+
assert isinstance(_format, bool)
484484
flags.append("-F")
485485

486486
if prevent_overwrite is not None and prevent_overwrite:
@@ -1012,6 +1012,25 @@ def kill_window(self) -> None:
10121012
if proc.stderr:
10131013
raise exc.LibTmuxException(proc.stderr)
10141014

1015+
def set_window_option(
1016+
self,
1017+
option: str,
1018+
value: int | str,
1019+
) -> Window:
1020+
"""Set option for tmux window. Deprecated by :meth:`Window.set_option()`.
1021+
1022+
.. deprecated:: 0.26
1023+
1024+
Deprecated by :meth:`Window.set_option()`.
1025+
1026+
"""
1027+
warnings.warn(
1028+
"Window.set_window_option() is deprecated",
1029+
category=DeprecationWarning,
1030+
stacklevel=2,
1031+
)
1032+
return self.set_option(option=option, value=value)
1033+
10151034
def get(self, key: str, default: t.Any | None = None) -> t.Any:
10161035
"""Return key-based lookup. Deprecated by attributes.
10171036

0 commit comments

Comments
 (0)