diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-12-05 16:25:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-05 15:25:18 +0000 |
| commit | caa72f4ec2401c275ddd3d8794dcf0bfdf9697a8 (patch) | |
| tree | 490fcf0e7d7e3deb947d377109d886ecb579081a /crates/typst-cli/src/args.rs | |
| parent | 8e4f5f21e0e52fb4ac88ab769e585af811d9b56e (diff) | |
Put HTTP server behind on-by-default feature flag (#5532)
Diffstat (limited to 'crates/typst-cli/src/args.rs')
| -rw-r--r-- | crates/typst-cli/src/args.rs | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs index ead93236..83c4c8f9 100644 --- a/crates/typst-cli/src/args.rs +++ b/crates/typst-cli/src/args.rs @@ -98,20 +98,10 @@ pub struct WatchCommand { #[clap(flatten)] pub args: CompileArgs, - /// Disables the built-in HTTP server for HTML export. - #[clap(long)] - pub no_serve: bool, - - /// Disables the injected live reload script for HTML export. The HTML that - /// is written to disk isn't affected either way. - #[clap(long)] - pub no_reload: bool, - - /// The port where HTML is served. - /// - /// Defaults to the first free port in the range 3000-3005. - #[clap(long)] - pub port: Option<u16>, + /// Arguments for the HTTP server. + #[cfg(feature = "http-server")] + #[clap(flatten)] + pub server: ServerArgs, } /// Initializes a new project from a template. @@ -354,7 +344,7 @@ pub struct PackageArgs { pub package_cache_path: Option<PathBuf>, } -/// Common arguments to customize available fonts +/// Common arguments to customize available fonts. #[derive(Debug, Clone, Parser)] pub struct FontArgs { /// Adds additional directories that are recursively searched for fonts. @@ -375,6 +365,26 @@ pub struct FontArgs { pub ignore_system_fonts: bool, } +/// Arguments for the HTTP server. +#[cfg(feature = "http-server")] +#[derive(Debug, Clone, Parser)] +pub struct ServerArgs { + /// Disables the built-in HTTP server for HTML export. + #[clap(long)] + pub no_serve: bool, + + /// Disables the injected live reload script for HTML export. The HTML that + /// is written to disk isn't affected either way. + #[clap(long)] + pub no_reload: bool, + + /// The port where HTML is served. + /// + /// Defaults to the first free port in the range 3000-3005. + #[clap(long)] + pub port: Option<u16>, +} + macro_rules! display_possible_values { ($ty:ty) => { impl Display for $ty { |
