Skip to content

Commit 52ed2e1

Browse files
committed
xtask/run: Add --data-dir flag
which will allow very quick iterations when not changing the plugins between builds.
1 parent b79107d commit 52ed2e1

File tree

2 files changed

+36
-16
lines changed

2 files changed

+36
-16
lines changed

xtask/src/flags.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ xflags::xflags! {
6161

6262
/// Run debug version of zellij
6363
cmd run {
64+
/// Take plugins from here, skip building plugins. Passed to zellij verbatim
65+
optional --data-dir path: PathBuf
6466
/// Arguments to pass after `cargo run --`
6567
repeated args: OsString
6668
}
@@ -169,6 +171,8 @@ pub struct Install {
169171
#[derive(Debug)]
170172
pub struct Run {
171173
pub args: Vec<OsString>,
174+
175+
pub data_dir: Option<PathBuf>,
172176
}
173177

174178
#[derive(Debug)]

xtask/src/pipelines.rs

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,37 @@ pub fn install(sh: &Shell, flags: flags::Install) -> anyhow::Result<()> {
9494
pub fn run(sh: &Shell, flags: flags::Run) -> anyhow::Result<()> {
9595
let err_context = || format!("failed to run pipeline 'run' with args {flags:?}");
9696

97-
build::build(
98-
sh,
99-
flags::Build {
100-
release: false,
101-
no_plugins: false,
102-
plugins_only: true,
103-
},
104-
)
105-
.and_then(|_| crate::cargo())
106-
.and_then(|cargo| {
107-
cmd!(sh, "{cargo} run --")
108-
.args(&flags.args)
109-
.run()
110-
.map_err(anyhow::Error::new)
111-
})
112-
.with_context(err_context)
97+
if let Some(ref data_dir) = flags.data_dir {
98+
let data_dir = sh.current_dir().join(data_dir);
99+
100+
crate::cargo()
101+
.and_then(|cargo| {
102+
cmd!(sh, "{cargo} run")
103+
.args(["--package", "zellij"])
104+
.args(["--features", "disable_automatic_asset_installation"])
105+
.args(["--", "--data-dir", &format!("{}", data_dir.display())])
106+
.run()
107+
.map_err(anyhow::Error::new)
108+
})
109+
.with_context(err_context)
110+
} else {
111+
build::build(
112+
sh,
113+
flags::Build {
114+
release: false,
115+
no_plugins: false,
116+
plugins_only: true,
117+
},
118+
)
119+
.and_then(|_| crate::cargo())
120+
.and_then(|cargo| {
121+
cmd!(sh, "{cargo} run --")
122+
.args(&flags.args)
123+
.run()
124+
.map_err(anyhow::Error::new)
125+
})
126+
.with_context(err_context)
127+
}
113128
}
114129

115130
/// Bundle all distributable content to `target/dist`.
@@ -146,6 +161,7 @@ pub fn dist(sh: &Shell, _flags: flags::Dist) -> anyhow::Result<()> {
146161
pub fn publish(sh: &Shell, flags: flags::Publish) -> anyhow::Result<()> {
147162
let err_context = "failed to publish zellij";
148163

164+
sh.change_dir(crate::project_root());
149165
let dry_run = if flags.dry_run {
150166
Some("--dry-run")
151167
} else {

0 commit comments

Comments
 (0)