From 0baa9d6b3230581043771ff9b4b846be912b7b23 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 24 Aug 2024 00:19:27 +0300 Subject: [PATCH] feat(cli): Catch missing required arguments at parse time --- src/cli.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index e0a8f4b4c..5e0e4ef81 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use clap::{Parser, ValueHint}; use std::path::PathBuf; /// The SILE Typesetter reads input file(s) and typesets the content into a rendered document @@ -85,7 +85,7 @@ pub struct Cli { /// An extension will be chosen based on the output backend, typically .pdf. /// With this option any arbitrary name and path can be given. /// Additionally `-` can be used to write the output to STDOUT. - #[clap(short, long, value_name = "FILE")] + #[clap(short, long, value_name = "FILE", required_if_eq("input", "-"))] pub output: Option, /// Set or override document class options.