Skip to content

Commit 8300f75

Browse files
authored
Read font path from environment variables (typst#649)
1 parent e4fda41 commit 8300f75

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ typst --font-path path/to/fonts compile file.typ
149149

150150
# Lists all of the discovered fonts in the system and the given directory.
151151
typst --font-path path/to/fonts fonts
152+
153+
# Or via environement variable (Linux syntax).
154+
TYPST_FONT_PATHS=path/to/fonts typst fonts
152155
```
153156

154157
If you prefer an integrated IDE-like experience with autocompletion and instant

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ once_cell = "1"
3232
same-file = "1"
3333
siphasher = "0.3"
3434
walkdir = "2"
35-
clap = { version = "4.2.1", features = ["derive"] }
35+
clap = { version = "4.2.1", features = ["derive", "env"] }
3636
open = "4.0.1"
3737

3838
[build-dependencies]

cli/src/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use clap::{ArgAction, Parser, Subcommand};
77
#[clap(name = "typst", version = crate::typst_version(), author)]
88
pub struct CliArguments {
99
/// Add additional directories to search for fonts
10-
#[clap(long = "font-path", value_name = "DIR", action = ArgAction::Append)]
10+
#[clap(long = "font-path", env = "TYPST_FONT_PATHS", value_name = "DIR", action = ArgAction::Append)]
1111
pub font_paths: Vec<PathBuf>,
1212

1313
/// Configure the root for absolute paths
14-
#[clap(long = "root", value_name = "DIR")]
14+
#[clap(long = "root", env = "TYPST_ROOT", value_name = "DIR")]
1515
pub root: Option<PathBuf>,
1616

1717
/// The typst command to run

0 commit comments

Comments
 (0)