Skip to content

Commit 3adf3cc

Browse files
committed
refactor!(Window): Deprecate set_window_option -> set_option
1 parent f2ea13e commit 3adf3cc

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
@@ -387,11 +387,11 @@ def select_layout(self, layout: str | None = None) -> Window:
387387

388388
return self
389389

390-
def set_window_option(
390+
def set_option(
391391
self,
392392
option: str,
393393
value: int | str,
394-
format: bool | None = None,
394+
_format: bool | None = None,
395395
unset: bool | None = None,
396396
unset_panes: bool | None = None,
397397
prevent_overwrite: bool | None = None,
@@ -430,8 +430,8 @@ def set_window_option(
430430
assert isinstance(unset_panes, bool)
431431
flags.append("-U")
432432

433-
if format is not None and format:
434-
assert isinstance(format, bool)
433+
if _format is not None and _format:
434+
assert isinstance(_format, bool)
435435
flags.append("-F")
436436

437437
if prevent_overwrite is not None and prevent_overwrite:
@@ -963,6 +963,25 @@ def kill_window(self) -> None:
963963
if proc.stderr:
964964
raise exc.LibTmuxException(proc.stderr)
965965

966+
def set_window_option(
967+
self,
968+
option: str,
969+
value: int | str,
970+
) -> Window:
971+
"""Set option for tmux window. Deprecated by :meth:`Window.set_option()`.
972+
973+
.. deprecated:: 0.26
974+
975+
Deprecated by :meth:`Window.set_option()`.
976+
977+
"""
978+
warnings.warn(
979+
"Window.set_window_option() is deprecated",
980+
category=DeprecationWarning,
981+
stacklevel=2,
982+
)
983+
return self.set_option(option=option, value=value)
984+
966985
def get(self, key: str, default: t.Any | None = None) -> t.Any:
967986
"""Return key-based lookup. Deprecated by attributes.
968987

0 commit comments

Comments
 (0)