diff options
| author | Jassiel Ovando <jassielovando@protonmail.com> | 2025-07-09 08:41:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-09 12:41:40 +0000 |
| commit | 1bbb58c43f6f5d94be4b2609728039a9922c75f8 (patch) | |
| tree | 77740e36cd889b6a1dfa14ce84be2ac781b02e2f /crates/typst-cli/src/args.rs | |
| parent | 1dc4c248d1022dc9f3b6e3e899857404f6c680a1 (diff) | |
Add completions subcommand (#6568)
Diffstat (limited to 'crates/typst-cli/src/args.rs')
| -rw-r--r-- | crates/typst-cli/src/args.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs index c3fd541a..7459be0f 100644 --- a/crates/typst-cli/src/args.rs +++ b/crates/typst-cli/src/args.rs @@ -7,6 +7,7 @@ use std::str::FromStr; use chrono::{DateTime, Utc}; use clap::builder::{TypedValueParser, ValueParser}; use clap::{ArgAction, Args, ColorChoice, Parser, Subcommand, ValueEnum, ValueHint}; +use clap_complete::Shell; use semver::Version; /// The character typically used to separate path components @@ -81,6 +82,9 @@ pub enum Command { /// Self update the Typst CLI. #[cfg_attr(not(feature = "self-update"), clap(hide = true))] Update(UpdateCommand), + + /// Generates shell completion scripts. + Completions(CompletionsCommand), } /// Compiles an input file into a supported output format. @@ -198,6 +202,14 @@ pub struct UpdateCommand { pub backup_path: Option<PathBuf>, } +/// Generates shell completion scripts. +#[derive(Debug, Clone, Parser)] +pub struct CompletionsCommand { + /// The shell to generate completions for. + #[arg(value_enum)] + pub shell: Shell, +} + /// Arguments for compilation and watching. #[derive(Debug, Clone, Args)] pub struct CompileArgs { |
