Skip to content

Commit 68c1d3e

Browse files
committed
chore(cli[load]): Typings
1 parent 520b7b5 commit 68c1d3e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/tmuxp/cli/load.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def _reattach(builder: WorkspaceBuilder):
158158
159159
If not, ``tmux attach-session`` loads the client to the target session.
160160
"""
161+
assert builder.session is not None
161162
for plugin in builder.plugins:
162163
plugin.reattach(builder.session)
163164
proc = builder.session.cmd("display-message", "-p", "'#S'")
@@ -181,6 +182,7 @@ def _load_attached(builder: WorkspaceBuilder, detached: bool) -> None:
181182
detached : bool
182183
"""
183184
builder.build()
185+
assert builder.session is not None
184186

185187
if "TMUX" in os.environ: # tmuxp ran from inside tmux
186188
# unset TMUX, save it, e.g. '/tmp/tmux-1000/default,30668,0'
@@ -214,6 +216,8 @@ def _load_detached(builder: WorkspaceBuilder) -> None:
214216
"""
215217
builder.build()
216218

219+
assert builder.session is not None
220+
217221
if has_gte_version("2.6"): # prepare for both cases
218222
set_layout_hook(builder.session, "client-attached")
219223
set_layout_hook(builder.session, "client-session-changed")
@@ -231,6 +235,7 @@ def _load_append_windows_to_current_session(builder: WorkspaceBuilder) -> None:
231235
"""
232236
current_attached_session = builder.find_current_attached_session()
233237
builder.build(current_attached_session, append=True)
238+
assert builder.session is not None
234239
if has_gte_version("2.6"): # prepare for both cases
235240
set_layout_hook(builder.session, "client-attached")
236241
set_layout_hook(builder.session, "client-session-changed")
@@ -244,6 +249,7 @@ def _setup_plugins(builder: WorkspaceBuilder) -> Session:
244249
----------
245250
builder: :class:`workspace.builder.WorkspaceBuilder`
246251
"""
252+
assert builder.session is not None
247253
for plugin in builder.plugins:
248254
plugin.before_script(builder.session)
249255

@@ -458,8 +464,9 @@ def load_workspace(
458464
)
459465

460466
if choice == "k":
461-
builder.session.kill_session()
462-
tmuxp_echo("Session killed.")
467+
if builder.session is not None:
468+
builder.session.kill_session()
469+
tmuxp_echo("Session killed.")
463470
elif choice == "a":
464471
_reattach(builder)
465472
else:

0 commit comments

Comments
 (0)