diff options
| author | Zicklag <zicklag@katharostech.com> | 2023-09-11 10:03:47 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-11 12:03:47 +0200 |
| commit | 6483d3035bab4df2d644acb738974413977aaa37 (patch) | |
| tree | 44b329b5ac2f0b22b75172abb5f55180f4862f75 /crates/typst-cli/src/main.rs | |
| parent | d056280165b981ef7a11f5bfb02417ef96760352 (diff) | |
Support proxy and custom certificate configuration. (#2006)
Diffstat (limited to 'crates/typst-cli/src/main.rs')
| -rw-r--r-- | crates/typst-cli/src/main.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/typst-cli/src/main.rs b/crates/typst-cli/src/main.rs index fe99e029..a6e60e5b 100644 --- a/crates/typst-cli/src/main.rs +++ b/crates/typst-cli/src/main.rs @@ -17,6 +17,7 @@ use std::process::ExitCode; use clap::Parser; use codespan_reporting::term::{self, termcolor}; +use once_cell::sync::Lazy; use termcolor::{ColorChoice, WriteColor}; use crate::args::{CliArguments, Command}; @@ -26,10 +27,12 @@ thread_local! { static EXIT: Cell<ExitCode> = Cell::new(ExitCode::SUCCESS); } +/// The parsed commandline arguments. +static ARGS: Lazy<CliArguments> = Lazy::new(CliArguments::parse); + /// Entry point. fn main() -> ExitCode { - let arguments = CliArguments::parse(); - let _guard = match crate::tracing::setup_tracing(&arguments) { + let _guard = match crate::tracing::setup_tracing(&ARGS) { Ok(guard) => guard, Err(err) => { eprintln!("failed to initialize tracing {}", err); @@ -37,9 +40,9 @@ fn main() -> ExitCode { } }; - let res = match arguments.command { - Command::Compile(command) => crate::compile::compile(command), - Command::Watch(command) => crate::watch::watch(command), + let res = match &ARGS.command { + Command::Compile(command) => crate::compile::compile(command.clone()), + Command::Watch(command) => crate::watch::watch(command.clone()), Command::Query(command) => crate::query::query(command), Command::Fonts(command) => crate::fonts::fonts(command), Command::Update(command) => crate::update::update(command), @@ -89,7 +92,7 @@ mod update { use crate::args::UpdateCommand; use typst::diag::{bail, StrResult}; - pub fn update(_: UpdateCommand) -> StrResult<()> { + pub fn update(_: &UpdateCommand) -> StrResult<()> { bail!( "self-updating is not enabled for this executable, \ please update with the package manager or mechanism \ |
