mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
Apply suggestions
This commit is contained in:
parent
6df56ad289
commit
0b1d137ee9
2 changed files with 8 additions and 4 deletions
|
@ -43,26 +43,30 @@ pub(crate) fn assert_arg(arg: &Arg) {
|
|||
);
|
||||
}
|
||||
|
||||
assert_app_flag(arg);
|
||||
assert_app_flags(arg);
|
||||
}
|
||||
|
||||
fn assert_app_flag(arg: &Arg) {
|
||||
fn assert_app_flags(arg: &Arg) {
|
||||
use ArgSettings::*;
|
||||
|
||||
macro_rules! checker {
|
||||
($a:ident requires $($b:ident)|+) => {
|
||||
if arg.is_set($a) {
|
||||
let mut s = String::new();
|
||||
|
||||
$(
|
||||
if !arg.is_set($b) {
|
||||
s.push_str(&format!("\nArgSettings::{} is required when ArgSettings::{} is on.\n", std::stringify!($b), std::stringify!($a)));
|
||||
s.push_str(&format!("\nArgSettings::{} is required when ArgSettings::{} is set.\n", std::stringify!($b), std::stringify!($a)));
|
||||
}
|
||||
)+
|
||||
|
||||
if !s.is_empty() {
|
||||
panic!("{}", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checker!(AllowEmptyValues requires TakesValue);
|
||||
checker!(RequireDelimiter requires TakesValue | UseValueDelimiter);
|
||||
checker!(HidePossibleValues requires TakesValue);
|
||||
|
|
|
@ -4296,7 +4296,7 @@ impl<'help> Arg<'help> {
|
|||
/// [`AppSettings::TrailingVarArg`]: ./enum.AppSettings.html#variant.TrailingVarArg
|
||||
#[inline]
|
||||
pub fn raw(self, raw: bool) -> Self {
|
||||
self.takes_value(true)
|
||||
self.takes_value(raw)
|
||||
.multiple(raw)
|
||||
.allow_hyphen_values(raw)
|
||||
.last(raw)
|
||||
|
|
Loading…
Add table
Reference in a new issue