summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src
diff options
context:
space:
mode:
authorfrozolotl <44589151+frozolotl@users.noreply.github.com>2023-11-24 05:42:02 -0500
committerGitHub <noreply@github.com>2023-11-24 11:42:02 +0100
commit76e173b78b511b506b928c27ac360f75fa455747 (patch)
tree9ca4dcdaaa3efffcec9919926cb0487220ee1d10 /crates/typst-cli/src
parente5470401f4861a6aa57a2a4dfd6ce0402de71e1d (diff)
Allow multiple font paths in `TYPST_FONT_PATHS` (#2746)
Diffstat (limited to 'crates/typst-cli/src')
-rw-r--r--crates/typst-cli/src/args.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs
index 2113e03c..cfd1ae08 100644
--- a/crates/typst-cli/src/args.rs
+++ b/crates/typst-cli/src/args.rs
@@ -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>,