(
root: &clap::Command,
key: &str,
argv: &[OsString],
arg: Option<&str>,
)
| 510 | } |
| 511 | |
| 512 | fn has_explicit_empty_value( |
| 513 | root: &clap::Command, |
| 514 | key: &str, |
| 515 | argv: &[OsString], |
| 516 | arg: Option<&str>, |
| 517 | ) -> bool { |
| 518 | let Some(arg) = arg else { |
| 519 | return argv.iter().skip(1).any(|value| value.is_empty()); |
| 520 | }; |
| 521 | if arg.trim_start().starts_with('-') { |
| 522 | return raw_option_value(root, key, argv, arg) |
| 523 | .is_some_and(|value| value.as_os_str().is_empty()); |
| 524 | } |
| 525 | |
| 526 | let start = command_scope_start(root, key, argv); |
| 527 | argv.iter() |
| 528 | .skip(start) |
| 529 | .any(|value| value.as_os_str().is_empty()) |
| 530 | } |
| 531 | |
| 532 | fn write_ignoring_errors(mut writer: impl std::io::Write, output: &str) { |
| 533 | let _ = std::io::Write::write_all(&mut writer, output.as_bytes()); |
no test coverage detected