Skip to content

Commit e090550

Browse files
committed
WIP: load multiple workspace files to same session name w/ --append
1 parent 5e93462 commit e090550

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

src/tmuxp/cli/load.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,21 @@ def command_load(
646646
detached = original_detached_option
647647
new_session_name = original_new_session_name
648648

649-
if last_idx > 0 and idx < last_idx:
650-
detached = True
651-
new_session_name = None
649+
if last_idx > 0:
650+
if idx < last_idx:
651+
detached = True
652+
new_session_name = None
653+
if tmux_options["append"]:
654+
original_session_name = None
655+
if idx == 0:
656+
original_session_name = (
657+
new_session_name
658+
or config_reader.ConfigReader._from_file(
659+
pathlib.Path(config_file)
660+
)
661+
)
662+
elif idx > 0 and original_session_name is not None:
663+
new_session_name = original_session_name
652664

653665
load_workspace(
654666
config_file,

tests/test_cli.py

+16
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,18 @@ class CLILoadFixture(t.NamedTuple):
521521
expected_in_out=None,
522522
expected_not_in_out=None,
523523
),
524+
CLILoadFixture(
525+
test_id="configdir-session-name-double-append",
526+
cli_args=["load", "my_config", "second_config", "--append"],
527+
config_paths=[
528+
"{TMUXP_CONFIGDIR}/my_config.yaml",
529+
"{TMUXP_CONFIGDIR}/second_config.yaml",
530+
],
531+
session_names=["my_config", "second_config"],
532+
expected_exit_code=0,
533+
expected_in_out=None,
534+
expected_not_in_out=None,
535+
),
524536
]
525537

526538

@@ -590,6 +602,10 @@ def test_load(
590602
for session_name in session_names:
591603
assert server.has_session(session_name)
592604

605+
if "--append" in cli_args:
606+
for session_name in session_names[-1:]:
607+
assert not server.has_session(session_name)
608+
593609

594610
def test_regression_00132_session_name_with_dots(
595611
tmp_path: pathlib.Path,

0 commit comments

Comments
 (0)