From 407e629523d1917f50d603dfb75b85e165eab7f1 Mon Sep 17 00:00:00 2001 From: Chris Zehner Date: Sat, 13 Mar 2021 19:11:50 -0600 Subject: [PATCH] Ignore extra fields in Arg yaml definitions --- src/build/arg/mod.rs | 5 +---- tests/fixtures/app.yaml | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs index 38f4e4c4..69cb27bf 100644 --- a/src/build/arg/mod.rs +++ b/src/build/arg/mod.rs @@ -4712,10 +4712,7 @@ impl<'help> From<&'help Yaml> for Arg<'help> { panic!("Failed to convert YAML value to vector") } } - s => panic!( - "Unknown Arg setting '{}' in YAML file for arg '{}'", - s, name_str - ), + _ => continue, // Ignore extra fields } } diff --git a/tests/fixtures/app.yaml b/tests/fixtures/app.yaml index 4d70bd43..15f955f8 100644 --- a/tests/fixtures/app.yaml +++ b/tests/fixtures/app.yaml @@ -4,11 +4,13 @@ about: tests clap library author: Kevin K. settings: - ArgRequiredElseHelp +ignored_field: This field is ignored args: - help: short: h long: help about: prints help with a nonstandard description + ignored_field: This field is ignored - option: short: o long: option