mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Remove SOURCE_DATE_EPOCH CLI argument (#3859)
This commit is contained in:
parent
8013f69714
commit
ffc9570c64
@ -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(
|
||||
|
@ -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
|
||||
|
@ -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()),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user