diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-06-09 22:49:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-09 22:49:12 +0200 |
commit | 8485b1c2969e7f88feaf2f809b6b405fbe442ba4 (patch) | |
tree | 989148565b8883d9a04e35f795a3f50008c0e1b1 /zellij-utils/src/input | |
parent | 7f0b87852079f260cc9a834c2dc54eeb002d5879 (diff) |
feat(plugins): extensive plugin api (#2516)
* feat(plugins): add our entire API
* style(fmt): rustfmt
* fix(detach): make it work again
Diffstat (limited to 'zellij-utils/src/input')
-rw-r--r-- | zellij-utils/src/input/command.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/zellij-utils/src/input/command.rs b/zellij-utils/src/input/command.rs index 3212d26ec..c05aa644a 100644 --- a/zellij-utils/src/input/command.rs +++ b/zellij-utils/src/input/command.rs @@ -10,6 +10,19 @@ pub enum TerminalAction { RunCommand(RunCommand), } +impl TerminalAction { + pub fn change_cwd(&mut self, new_cwd: PathBuf) { + match self { + TerminalAction::OpenFile(_, _, cwd) => { + *cwd = Some(new_cwd); + }, + TerminalAction::RunCommand(run_command) => { + run_command.cwd = Some(new_cwd); + }, + } + } +} + #[derive(Clone, Debug, Deserialize, Default, Serialize, PartialEq, Eq)] pub struct RunCommand { #[serde(alias = "cmd")] @@ -69,6 +82,19 @@ impl From<RunCommandAction> for RunCommand { } } +impl From<RunCommand> for RunCommandAction { + fn from(run_command: RunCommand) -> Self { + RunCommandAction { + command: run_command.command, + args: run_command.args, + cwd: run_command.cwd, + direction: None, + hold_on_close: run_command.hold_on_close, + hold_on_start: run_command.hold_on_start, + } + } +} + impl RunCommand { pub fn new(command: PathBuf) -> Self { RunCommand { |