Skip to content

Commit

Permalink
WIP: load multiple workspace files to same session name w/ --append
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Oct 29, 2022
1 parent fff6f4f commit 5466251
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/tmuxp/cli/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,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(
config_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 @@ -521,6 +521,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 @@ -590,6 +602,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

0 comments on commit 5466251

Please sign in to comment.