mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Read font path from environment variables (#649)
This commit is contained in:
parent
e4fda4176e
commit
8300f75f22
@ -149,6 +149,9 @@ typst --font-path path/to/fonts compile file.typ
|
|||||||
|
|
||||||
# Lists all of the discovered fonts in the system and the given directory.
|
# Lists all of the discovered fonts in the system and the given directory.
|
||||||
typst --font-path path/to/fonts fonts
|
typst --font-path path/to/fonts fonts
|
||||||
|
|
||||||
|
# Or via environement variable (Linux syntax).
|
||||||
|
TYPST_FONT_PATHS=path/to/fonts typst fonts
|
||||||
```
|
```
|
||||||
|
|
||||||
If you prefer an integrated IDE-like experience with autocompletion and instant
|
If you prefer an integrated IDE-like experience with autocompletion and instant
|
||||||
|
@ -32,7 +32,7 @@ once_cell = "1"
|
|||||||
same-file = "1"
|
same-file = "1"
|
||||||
siphasher = "0.3"
|
siphasher = "0.3"
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
clap = { version = "4.2.1", features = ["derive"] }
|
clap = { version = "4.2.1", features = ["derive", "env"] }
|
||||||
open = "4.0.1"
|
open = "4.0.1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
@ -7,11 +7,11 @@ use clap::{ArgAction, Parser, Subcommand};
|
|||||||
#[clap(name = "typst", version = crate::typst_version(), author)]
|
#[clap(name = "typst", version = crate::typst_version(), author)]
|
||||||
pub struct CliArguments {
|
pub struct CliArguments {
|
||||||
/// Add additional directories to search for fonts
|
/// Add additional directories to search for fonts
|
||||||
#[clap(long = "font-path", value_name = "DIR", action = ArgAction::Append)]
|
#[clap(long = "font-path", env = "TYPST_FONT_PATHS", value_name = "DIR", action = ArgAction::Append)]
|
||||||
pub font_paths: Vec<PathBuf>,
|
pub font_paths: Vec<PathBuf>,
|
||||||
|
|
||||||
/// Configure the root for absolute paths
|
/// Configure the root for absolute paths
|
||||||
#[clap(long = "root", value_name = "DIR")]
|
#[clap(long = "root", env = "TYPST_ROOT", value_name = "DIR")]
|
||||||
pub root: Option<PathBuf>,
|
pub root: Option<PathBuf>,
|
||||||
|
|
||||||
/// The typst command to run
|
/// The typst command to run
|
||||||
|
Loading…
x
Reference in New Issue
Block a user