Skip to content

Commit c1d7e8a

Browse files
authored
refactor: Remove reundant targets (#536)
Eliminate redundant targets / window_index's across codebase.
2 parents 9eac8b0 + 22b51e8 commit c1d7e8a

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

CHANGES

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ $ pip install --user --upgrade --pre libtmux
1515

1616
<!-- To maintainers and contributors: Please add notes for the forthcoming version above -->
1717

18+
### Breaking changes
19+
20+
- Eliminate redundant targets / `window_index`'s across codebase (#536).
21+
1822
## libtmux 0.34.0 (2024-03-17)
1923

2024
### Breaking changes

src/libtmux/session.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def switch_client(self) -> "Session":
497497
------
498498
:exc:`exc.LibTmuxException`
499499
"""
500-
proc = self.cmd("switch-client", target=self.session_id)
500+
proc = self.cmd("switch-client")
501501

502502
if proc.stderr:
503503
raise exc.LibTmuxException(proc.stderr)
@@ -803,7 +803,7 @@ def attach_session(self) -> "Session":
803803
category=DeprecationWarning,
804804
stacklevel=2,
805805
)
806-
proc = self.cmd("attach-session", target=self.session_id)
806+
proc = self.cmd("attach-session")
807807

808808
if proc.stderr:
809809
raise exc.LibTmuxException(proc.stderr)
@@ -824,7 +824,7 @@ def kill_session(self) -> None:
824824
category=DeprecationWarning,
825825
stacklevel=2,
826826
)
827-
proc = self.cmd("kill-session", target=self.session_id)
827+
proc = self.cmd("kill-session")
828828

829829
if proc.stderr:
830830
raise exc.LibTmuxException(proc.stderr)

src/libtmux/window.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def select_pane(self, target_pane: t.Union[str, int]) -> t.Optional["Pane"]:
194194
:class:`Pane`
195195
"""
196196
if target_pane in ["-l", "-U", "-D", "-L", "-R"]:
197-
proc = self.cmd("select-pane", target_pane, target=self.window_id)
197+
proc = self.cmd("select-pane", target_pane)
198198
else:
199199
proc = self.cmd("select-pane", target=target_pane)
200200

@@ -378,7 +378,7 @@ def select_layout(self, layout: t.Optional[str] = None) -> "Window":
378378
if layout: # tmux allows select-layout without args
379379
cmd.append(layout)
380380

381-
proc = self.cmd(*cmd, target=f"{self.session_id}:{self.window_index}")
381+
proc = self.cmd(*cmd)
382382

383383
if proc.stderr:
384384
raise exc.LibTmuxException(proc.stderr)
@@ -412,7 +412,6 @@ def set_window_option(self, option: str, value: t.Union[int, str]) -> "Window":
412412
"set-window-option",
413413
option,
414414
value,
415-
target=f"{self.session_id}:{self.window_index}",
416415
)
417416

418417
if isinstance(cmd.stderr, list) and len(cmd.stderr):
@@ -920,10 +919,7 @@ def kill_window(self) -> None:
920919
category=DeprecationWarning,
921920
stacklevel=2,
922921
)
923-
proc = self.cmd(
924-
"kill-window",
925-
target=f"{self.session_id}:{self.window_index}",
926-
)
922+
proc = self.cmd("kill-window")
927923

928924
if proc.stderr:
929925
raise exc.LibTmuxException(proc.stderr)

0 commit comments

Comments
 (0)