Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmuxp load: Load multiple sessions with --append #839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/tmuxp/cli/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,21 @@ def command_load(
detached = original_detached_option
new_session_name = original_new_session_name

if last_idx > 0 and idx < last_idx:
detached = True
new_session_name = None
if last_idx > 0:
if idx < last_idx:
detached = True
new_session_name = None
if tmux_options["append"]:
original_session_name = None
if idx == 0:
original_session_name = (
new_session_name
or config_reader.ConfigReader._from_file(
pathlib.Path(config_file)
)
)
elif idx > 0 and original_session_name is not None:
new_session_name = original_session_name

load_workspace(
workspace_file,
Expand Down
16 changes: 16 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,18 @@ class CLILoadFixture(t.NamedTuple):
expected_in_out=None,
expected_not_in_out=None,
),
CLILoadFixture(
test_id="configdir-session-name-double-append",
cli_args=["load", "my_config", "second_config", "--append"],
config_paths=[
"{TMUXP_CONFIGDIR}/my_config.yaml",
"{TMUXP_CONFIGDIR}/second_config.yaml",
],
session_names=["my_config", "second_config"],
expected_exit_code=0,
expected_in_out=None,
expected_not_in_out=None,
),
]


Expand Down Expand Up @@ -355,6 +367,10 @@ def test_load(
for session_name in session_names:
assert server.has_session(session_name)

if "--append" in cli_args:
for session_name in session_names[-1:]:
assert not server.has_session(session_name)


def test_regression_00132_session_name_with_dots(
tmp_path: pathlib.Path,
Expand Down