summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-11-01 21:02:27 +0100
committerGitHub <noreply@github.com>2024-11-01 20:02:27 +0000
commitfac75837458e4f7be4f501e40331b8162d90a1f8 (patch)
tree06ff639e37555c98178934960a5e963f27de2b90 /crates/typst-cli/src
parentb357de3c484e0cb320b0e3b778498815489f6a0d (diff)
Basic feature flag mechanism (#5350)
Diffstat (limited to 'crates/typst-cli/src')
-rw-r--r--crates/typst-cli/src/args.rs9
-rw-r--r--crates/typst-cli/src/world.rs5
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()