From a33d8bf32208ef0fe8556200dd0c9c5a1ad10c54 Mon Sep 17 00:00:00 2001 From: frozolotl <44589151+frozolotl@users.noreply.github.com> Date: Sat, 23 Mar 2024 12:54:50 +0100 Subject: Escape path and entrypoint in `typst init` output (#3753) --- crates/typst-cli/Cargo.toml | 1 + crates/typst-cli/src/init.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'crates/typst-cli') diff --git a/crates/typst-cli/Cargo.toml b/crates/typst-cli/Cargo.toml index 57251a64..65803a1d 100644 --- a/crates/typst-cli/Cargo.toml +++ b/crates/typst-cli/Cargo.toml @@ -51,6 +51,7 @@ semver = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } +shell-escape = { workspace = true } tar = { workspace = true } tempfile = { workspace = true } toml = { workspace = true } diff --git a/crates/typst-cli/src/init.rs b/crates/typst-cli/src/init.rs index 01fdb02f..b0446bd1 100644 --- a/crates/typst-cli/src/init.rs +++ b/crates/typst-cli/src/init.rs @@ -104,11 +104,19 @@ fn print_summary( out.set_color(&gray)?; write!(out, "> ")?; out.reset()?; - writeln!(out, "cd {}", project_dir.display())?; + writeln!( + out, + "cd {}", + shell_escape::escape(project_dir.display().to_string().into()), + )?; out.set_color(&gray)?; write!(out, "> ")?; out.reset()?; - writeln!(out, "typst watch {}", template.entrypoint)?; + writeln!( + out, + "typst watch {}", + shell_escape::escape(template.entrypoint.to_string().into()), + )?; writeln!(out)?; Ok(()) } -- cgit v1.2.3