From 5c411fc986bd1a92e9ca81c851a44de8ab167188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natalie=20Klestrup=20R=C3=B6ijezon?= Date: Fri, 25 Oct 2024 00:39:26 +0200 Subject: [PATCH] Report an error if an invalid --for= argument is supplied, instead of ignoring it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Natalie Klestrup Röijezon --- examples/event_watcher.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/event_watcher.rs b/examples/event_watcher.rs index 62b03c29e..dd33229f0 100644 --- a/examples/event_watcher.rs +++ b/examples/event_watcher.rs @@ -36,6 +36,8 @@ async fn main() -> anyhow::Result<()> { if let Some(forval) = app.r#for { if let Some((kind, name)) = forval.split_once('/') { conf = conf.fields(&format!("regarding.kind={kind},regarding.name={name}")); + } else { + return Err(anyhow::Error::msg("Usage: --for=/")); } } let event_stream = watcher(events, conf).default_backoff().applied_objects();