Allow multiple font paths in TYPST_FONT_PATHS (#2746)

This commit is contained in:
frozolotl 2023-11-24 05:42:02 -05:00 committed by GitHub
parent e5470401f4
commit 76e173b78b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,10 @@ use semver::Version;
use clap::{ArgAction, Args, Parser, Subcommand, ValueEnum};
/// The character typically used to separate path components
/// in environment variables.
const ENV_PATH_SEP: char = if cfg!(windows) { ';' } else { ':' };
/// The Typst compiler.
#[derive(Debug, Clone, Parser)]
#[clap(name = "typst", version = crate::typst_version(), author)]
@ -118,7 +122,7 @@ pub struct SharedArgs {
long = "font-path",
env = "TYPST_FONT_PATHS",
value_name = "DIR",
action = ArgAction::Append,
value_delimiter = ENV_PATH_SEP,
)]
pub font_paths: Vec<PathBuf>,
@ -139,7 +143,7 @@ pub struct FontsCommand {
long = "font-path",
env = "TYPST_FONT_PATHS",
value_name = "DIR",
action = ArgAction::Append,
value_delimiter = ENV_PATH_SEP,
)]
pub font_paths: Vec<PathBuf>,