diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-11-01 21:02:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-01 20:02:27 +0000 |
| commit | fac75837458e4f7be4f501e40331b8162d90a1f8 (patch) | |
| tree | 06ff639e37555c98178934960a5e963f27de2b90 /crates/typst-cli/src | |
| parent | b357de3c484e0cb320b0e3b778498815489f6a0d (diff) | |
Basic feature flag mechanism (#5350)
Diffstat (limited to 'crates/typst-cli/src')
| -rw-r--r-- | crates/typst-cli/src/args.rs | 9 | ||||
| -rw-r--r-- | crates/typst-cli/src/world.rs | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs index a4ac4bd9..9437f848 100644 --- a/crates/typst-cli/src/args.rs +++ b/crates/typst-cli/src/args.rs @@ -274,8 +274,17 @@ pub struct SharedArgs { /// defaults to number of CPUs. Setting it to 1 disables parallelism. #[clap(long, short)] pub jobs: Option<usize>, + + /// Enables in-development features that may be changed or removed at any + /// time. + #[arg(long = "feature", value_delimiter = ',')] + pub feature: Vec<Feature>, } +/// An in-development feature that may be changed or removed at any time. +#[derive(Debug, Copy, Clone, Eq, PartialEq, ValueEnum)] +pub enum Feature {} + /// Arguments related to where packages are stored in the system. #[derive(Debug, Clone, Args)] pub struct PackageStorageArgs { diff --git a/crates/typst-cli/src/world.rs b/crates/typst-cli/src/world.rs index f3597544..a04de2c0 100644 --- a/crates/typst-cli/src/world.rs +++ b/crates/typst-cli/src/world.rs @@ -112,7 +112,10 @@ impl SystemWorld { .map(|(k, v)| (k.as_str().into(), v.as_str().into_value())) .collect(); - Library::builder().with_inputs(inputs).build() + let features = + command.feature.iter().map(|&feature| match feature {}).collect(); + + Library::builder().with_inputs(inputs).with_features(features).build() }; let fonts = Fonts::searcher() |
