Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge pr/663: CLI: accept a UTF-8 BOM in scripts and document the syntax in script --help (#663)

aiongg605b31c6d6ba
diff --cc apps/designcraft-cli/src/main.rs
index dff5566d7,dd62cd91d..bce66430d
--- a/apps/designcraft-cli/src/main.rs
+++ b/apps/designcraft-cli/src/main.rs
@@@ -372,11 -364,12 +403,15 @@@ fn script(args: &[String]) -> Result<()
"--sample" => setup.push(("file.newSample".into(), json!({}))),
"--connect" => connect = Some(val()?),
"--save" => save = Some(val()?),
- "--export" => export.push(val()?),
+ "--export" => {
+ let out = val()?;
+ export.push((Export::of(&out)?, out));
+ }
"--keep-going" => keep_going = true,
+ "--help" | "-h" => {
+ outln!("{SCRIPT_HELP}");
+ return Ok(());
+ }
f if !f.starts_with("--") && file.is_none() => file = Some(f.to_string()),
other => return Err(format!("unknown script option `{other}`")),
}