diff options
author | Aram Drevekenin <aram@poor.dev> | 2022-11-01 09:07:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 09:07:25 +0100 |
commit | abc700fc4d10d61c969ad94fa520d7d9336dcf14 (patch) | |
tree | a2e6318c4fe3951236cfa758befce8b95393a26e /src | |
parent | 6d29c6951e4768cc6f2f3c7b1bbb708d79d860c9 (diff) |
feat(command-panes): allow to start suspended (#1887)
* feat(command-panes): allow panes to start suspended
* style(fmt): remove unused code
* style(fmt): rustfmt
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/tests/e2e/cases.rs | 19 | ||||
-rw-r--r-- | src/tests/e2e/remote_runner.rs | 3 | ||||
-rw-r--r-- | src/tests/e2e/snapshots/zellij__tests__e2e__cases__send_command_through_the_cli.snap | 8 |
4 files changed, 27 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 3ed592c53..6203f0f16 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,7 @@ fn main() { floating, name, close_on_exit, + start_suspended, })) = opts.command { let command_cli_action = CliAction::NewPane { @@ -35,6 +36,7 @@ fn main() { floating, name, close_on_exit, + start_suspended, }; commands::send_action_to_session(command_cli_action, opts.session); std::process::exit(0); diff --git a/src/tests/e2e/cases.rs b/src/tests/e2e/cases.rs index 44551d997..359d74162 100644 --- a/src/tests/e2e/cases.rs +++ b/src/tests/e2e/cases.rs @@ -1915,6 +1915,25 @@ pub fn send_command_through_the_cli() { }, }) .add_step(Step { + name: "Initial run of suspended command", + instruction: |mut remote_terminal: RemoteTerminal| -> bool { + let mut step_is_complete = false; + if remote_terminal.snapshot_contains("<Ctrl-c>") + && remote_terminal.cursor_position_is(0, 0) + // cursor does not appear in + // suspend_start panes + { + remote_terminal.send_key(&SPACE); // run script - here we use SPACE + // instead of the default ENTER because + // sending ENTER over SSH can be a little + // problematic (read: I couldn't get it + // to pass consistently) + step_is_complete = true + } + step_is_complete + }, + }) + .add_step(Step { name: "Wait for command to run", instruction: |mut remote_terminal: RemoteTerminal| -> bool { let mut step_is_complete = false; diff --git a/src/tests/e2e/remote_runner.rs b/src/tests/e2e/remote_runner.rs index dd2c800da..9b007989c 100644 --- a/src/tests/e2e/remote_runner.rs +++ b/src/tests/e2e/remote_runner.rs @@ -346,7 +346,8 @@ impl RemoteTerminal { let mut channel = self.channel.lock().unwrap(); channel .write_all( - format!("{} run -- \"{}\"\n", ZELLIJ_EXECUTABLE_LOCATION, command).as_bytes(), + // note that this is run with the -s flag that suspends the command on startup + format!("{} run -s -- \"{}\"\n", ZELLIJ_EXECUTABLE_LOCATION, command).as_bytes(), ) .unwrap(); channel.flush().unwrap(); diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__send_command_through_the_cli.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__send_command_through_the_cli.snap index 84d33a037..0603ac26e 100644 --- a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__send_command_through_the_cli.snap +++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__send_command_through_the_cli.snap @@ -1,14 +1,14 @@ --- source: src/tests/e2e/cases.rs -assertion_line: 1968 +assertion_line: 1998 expression: last_snapshot --- Zellij (e2e-test) Tab #1 ┌ Pane #1 ─────────────────────────────────────────────────┐┌ /usr/src/zellij/fixtures/append-echo-script.sh ──────────┐ │$ /usr/src/zellij/x86_64-unknown-linux-musl/release/zellij││foo │ -│ run -- "/usr/src/zellij/fixtures/append-echo-script.sh" ││foo │ -│$ ││█ │ -│ ││ │ +│ run -s -- "/usr/src/zellij/fixtures/append-echo-script.sh││foo │ +│" ││█ │ +│$ ││ │ │ ││ │ │ ││ │ │ ││ │ |