From 349b571e09cce317eed3c2cf4db3ad7e34f82bb8 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Wed, 8 Nov 2023 16:49:23 +0100 Subject: [PATCH] Issue #19: Do not allow check listing in combination with file check --- src/cli.rs | 7 +++++-- src/main.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 60e7977..8f07092 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -107,12 +107,15 @@ pub enum SubCommand { strict: bool, }, #[command(about = "Überprüfe OSC-Datei auf bekannte Problemen")] + #[group(multiple = false)] Check { - file: String, + #[arg(help = "Die zu prüfende Datei", group = "check-file", required = true)] + file: Option, #[arg( short = 'p', long = "password", - help = "Passwort der OSB-Datei (Optional - für OSB-Dateien)" + help = "Passwort der OSB-Datei (Optional - für OSB-Dateien)", + requires = "check-file" )] password: Option, #[arg( diff --git a/src/main.rs b/src/main.rs index be5dd18..5b2d54b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -272,7 +272,7 @@ fn main() -> Result<(), Box> { if list { print_checks(); } else { - let notices = check_file(Path::new(file.as_str()), password); + let notices = check_file(Path::new(file.unwrap_or_default().as_str()), password); println!( "Es wurden {} Probleme gefunden\n", notices