summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src/compile.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-cli/src/compile.rs')
-rw-r--r--crates/typst-cli/src/compile.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs
index c2d6ea01..49a6b6eb 100644
--- a/crates/typst-cli/src/compile.rs
+++ b/crates/typst-cli/src/compile.rs
@@ -22,9 +22,15 @@ type CodespanError = codespan_reporting::files::Error;
impl CompileCommand {
/// The output path.
pub fn output(&self) -> PathBuf {
- self.output
- .clone()
- .unwrap_or_else(|| self.common.input.with_extension("pdf"))
+ self.output.clone().unwrap_or_else(|| {
+ self.common.input.with_extension(
+ match self.output_format().unwrap_or(OutputFormat::Pdf) {
+ OutputFormat::Pdf => "pdf",
+ OutputFormat::Png => "png",
+ OutputFormat::Svg => "svg",
+ },
+ )
+ })
}
/// The format to use for generated output, either specified by the user or inferred from the extension.