Remove SOURCE_DATE_EPOCH CLI argument (#3859)

This commit is contained in:
frozolotl 2024-04-04 17:00:02 +02:00 committed by GitHub
parent 8013f69714
commit ffc9570c64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -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(

View File

@ -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

View File

@ -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()),
};