diff options
| author | Yip Coekjan <69834864+Coekjan@users.noreply.github.com> | 2024-08-24 05:37:03 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-23 21:37:03 +0000 |
| commit | 88325d7d019fd65c5177a92df4347ae9a287fc19 (patch) | |
| tree | 60d07d2022cb36425b6ed7992102087df4c2f4e4 /crates/typst-cli | |
| parent | 4dc2034eeeb8ed0f17dc2a5d48a98512f4ed818a (diff) | |
Add `clap::ValueHint` for input & output CLI arguments (#4765)
Diffstat (limited to 'crates/typst-cli')
| -rw-r--r-- | crates/typst-cli/src/args.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs index 09189de8..946afbc3 100644 --- a/crates/typst-cli/src/args.rs +++ b/crates/typst-cli/src/args.rs @@ -6,7 +6,7 @@ use std::str::FromStr; use chrono::{DateTime, Utc}; use clap::builder::{TypedValueParser, ValueParser}; -use clap::{ArgAction, Args, ColorChoice, Parser, Subcommand, ValueEnum}; +use clap::{ArgAction, Args, ColorChoice, Parser, Subcommand, ValueEnum, ValueHint}; use semver::Version; /// The character typically used to separate path components @@ -77,7 +77,11 @@ pub struct CompileCommand { /// must be present if the source document renders to multiple pages. Use `{p}` for page /// numbers, `{0p}` for zero padded page numbers and `{t}` for page count. For example, /// `page-{0p}-of-{t}.png` creates `page-01-of-10.png`, `page-02-of-10.png` and so on. - #[clap(required_if_eq("input", "-"), value_parser = make_output_value_parser())] + #[clap( + required_if_eq("input", "-"), + value_parser = make_output_value_parser(), + value_hint = ValueHint::FilePath, + )] pub output: Option<Output>, /// Which pages to export. When unspecified, all document pages are exported. @@ -177,7 +181,7 @@ pub enum SerializationFormat { #[derive(Debug, Clone, Args)] pub struct SharedArgs { /// Path to input Typst file. Use `-` to read input from stdin - #[clap(value_parser = make_input_value_parser())] + #[clap(value_parser = make_input_value_parser(), value_hint = ValueHint::FilePath)] pub input: Input, /// Configures the project root (for absolute paths) |
