We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a2adae4 commit bffa882Copy full SHA for bffa882
1 file changed
lib/src/parse.rs
@@ -740,11 +740,19 @@ fn validate_choices(
740
choices: Option<&SpecChoices>,
741
custom_env: Option<&HashMap<String, String>>,
742
) -> miette::Result<bool> {
743
+ if is_help_arg(spec, value)
744
+ && choices.is_some_and(|choices| {
745
+ !choices
746
+ .values_with_env(custom_env)
747
+ .iter()
748
+ .any(|choice| choice == value)
749
+ })
750
+ {
751
+ errors.push(render_help_err(spec, cmd, value.len() > 2));
752
+ return Ok(true);
753
+ }
754
+
755
if let Some(err) = choice_error(target, value, choices, custom_env) {
- if is_help_arg(spec, value) {
- errors.push(render_help_err(spec, cmd, value.len() > 2));
- return Ok(true);
- }
756
bail!("{err}");
757
}
758
Ok(false)
0 commit comments