summaryrefslogtreecommitdiffstats
path: root/zellij-utils
diff options
context:
space:
mode:
authorspacemaison <tuchsen@protonmail.com>2021-09-10 08:35:06 -0700
committerGitHub <noreply@github.com>2021-09-10 17:35:06 +0200
commit4f94f95c90a0b5c2cb3992533cec40cc55f05983 (patch)
tree006824300f43717d08862eeb8ebb08c151dd62c4 /zellij-utils
parent26a970a7d8a0f3703124ab3bb57cff4d296a2e33 (diff)
feat(cwd-pane): Keeping the cwd when opening new panes (#691)
* feat(cwd-pane): Add a new trait to get the cwd of a given pid Co-authored-by: Quentin Rasmont <qrasmont@gmail.com> * feat(cwd-pane): Allow for setting the cwd when spawning a new terminal Co-authored-by: Quentin Rasmont <qrasmont@gmail.com> * feat(cwd-pane): Add an active_pane field to the Pty struct Co-authored-by: Quentin Rasmont <qrasmont@gmail.com> * feat(cwd-pane): Update Pty with Tab's active pane id Co-authored-by: Quentin Rasmont <qrasmont@gmail.com> * feat(cwd-pane): Refactor spawn_terminal to use cwd by default Co-authored-by: Quentin Rasmont <qrasmont@gmail.com> * feat(cwd-pane): Fix tests and lints Co-authored-by: Quentin Rasmont <qrasmont@gmail.com> * feat(cwd-pane): Fix formatting * feat(cwd-pane): Refactor child pid fetching to handle errors better Instead of panicking when transfering the process id of the forked child command we just return an empty process id. * feat(cwd-pane): Add non Linux/MacOS targets for the get_cwd method. This will allow Zellij to compile on non Linux/MacOS targets without having an inherited cwd. * feat(cwd-pane): Refactor spawn_terminal method to use ChildId struct. The spawn_terminal methods been refactored to use the ChildId struct in order to clarify what the Pid's returned by it are. The documentation for the ChildId struct was improved as well. * feat(cwd-pane): Fix tests/lints Co-authored-by: Jesse Tuchsen <not@disclosing> Co-authored-by: Quentin Rasmont <qrasmont@gmail.com>
Diffstat (limited to 'zellij-utils')
-rw-r--r--zellij-utils/src/errors.rs1
-rw-r--r--zellij-utils/src/input/command.rs5
2 files changed, 6 insertions, 0 deletions
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 65a54c560..87c3bb4dc 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -237,6 +237,7 @@ pub enum PtyContext {
SpawnTerminal,
SpawnTerminalVertically,
SpawnTerminalHorizontally,
+ UpdateActivePane,
NewTab,
ClosePane,
CloseTab,
diff --git a/zellij-utils/src/input/command.rs b/zellij-utils/src/input/command.rs
index 2054f208d..debd5bc59 100644
--- a/zellij-utils/src/input/command.rs
+++ b/zellij-utils/src/input/command.rs
@@ -15,6 +15,8 @@ pub struct RunCommand {
pub command: PathBuf,
#[serde(default)]
pub args: Vec<String>,
+ #[serde(default)]
+ pub cwd: Option<PathBuf>,
}
/// Intermediate representation
@@ -25,6 +27,8 @@ pub struct RunCommandAction {
#[serde(default)]
pub args: Vec<String>,
#[serde(default)]
+ pub cwd: Option<PathBuf>,
+ #[serde(default)]
pub direction: Option<Direction>,
}
@@ -33,6 +37,7 @@ impl From<RunCommandAction> for RunCommand {
RunCommand {
command: action.command,
args: action.args,
+ cwd: action.cwd,
}
}
}