summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrozolotl <44589151+frozolotl@users.noreply.github.com>2024-04-04 17:00:02 +0200
committerGitHub <noreply@github.com>2024-04-04 15:00:02 +0000
commitffc9570c643540282d35dfe3075567c1200e4171 (patch)
treee9ffdd8d361beb0eefac6cd78c2a5b14b2a80249
parent8013f69714456043f5334670b6ecec2963309622 (diff)
Remove SOURCE_DATE_EPOCH CLI argument (#3859)
-rw-r--r--crates/typst-cli/src/args.rs9
-rw-r--r--crates/typst-cli/src/compile.rs2
-rw-r--r--crates/typst-cli/src/world.rs2
3 files changed, 9 insertions, 4 deletions
diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs
index 14173a55..689785df 100644
--- a/crates/typst-cli/src/args.rs
+++ b/crates/typst-cli/src/args.rs
@@ -171,8 +171,13 @@ pub struct SharedArgs {
/// The document's creation date formatted as a UNIX timestamp.
///
/// For more information, see <https://reproducible-builds.org/specs/source-date-epoch/>.
- #[clap(env = "SOURCE_DATE_EPOCH", value_parser = parse_source_date_epoch)]
- pub source_date_epoch: Option<DateTime<Utc>>,
+ #[clap(
+ long = "creation-timestamp",
+ env = "SOURCE_DATE_EPOCH",
+ value_name = "UNIX_TIMESTAMP",
+ value_parser = parse_source_date_epoch,
+ )]
+ pub creation_timestamp: Option<DateTime<Utc>>,
/// The format to emit diagnostics in
#[clap(
diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs
index e6f8b241..6273615c 100644
--- a/crates/typst-cli/src/compile.rs
+++ b/crates/typst-cli/src/compile.rs
@@ -167,7 +167,7 @@ fn export(
/// Export to a PDF.
fn export_pdf(document: &Document, command: &CompileCommand) -> StrResult<()> {
let timestamp = convert_datetime(
- command.common.source_date_epoch.unwrap_or_else(chrono::Utc::now),
+ command.common.creation_timestamp.unwrap_or_else(chrono::Utc::now),
);
let buffer = typst_pdf::pdf(document, Smart::Auto, timestamp);
command
diff --git a/crates/typst-cli/src/world.rs b/crates/typst-cli/src/world.rs
index e0215130..99da838c 100644
--- a/crates/typst-cli/src/world.rs
+++ b/crates/typst-cli/src/world.rs
@@ -105,7 +105,7 @@ impl SystemWorld {
let mut searcher = FontSearcher::new();
searcher.search(&command.font_paths);
- let now = match command.source_date_epoch {
+ let now = match command.creation_timestamp {
Some(time) => Now::Fixed(time),
None => Now::System(OnceLock::new()),
};