mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
refactor: changes validator signature to match v3
This commit is contained in:
parent
1b257f54b8
commit
cbd378e539
1 changed files with 11 additions and 3 deletions
|
@ -88,7 +88,7 @@ fn test_parse_hex() {
|
|||
fn custom_parser_1(_: &str) -> &'static str { "A" }
|
||||
fn custom_parser_2(_: &str) -> Result<&'static str, u32> { Ok("B") }
|
||||
fn custom_parser_3(_: &OsStr) -> &'static str { "C" }
|
||||
fn custom_parser_4(_: &OsStr) -> Result<&'static str, OsString> { Ok("D") }
|
||||
fn custom_parser_4(_: &OsStr) -> Result<&'static str, String> { Ok("D") }
|
||||
|
||||
#[derive(Clap, PartialEq, Debug)]
|
||||
struct NoOpOpt {
|
||||
|
@ -172,7 +172,11 @@ struct Occurrences {
|
|||
#[clap(short = "r", parse(from_occurrences))]
|
||||
little_unsigned: u8,
|
||||
|
||||
#[clap(short = "c", long = "custom", parse(from_occurrences = "foo"))]
|
||||
#[clap(
|
||||
short = "c",
|
||||
long = "custom",
|
||||
parse(from_occurrences = "foo")
|
||||
)]
|
||||
custom: Foo,
|
||||
}
|
||||
|
||||
|
@ -205,7 +209,11 @@ fn test_custom_bool() {
|
|||
struct Opt {
|
||||
#[clap(short = "d", parse(try_from_str = "parse_bool"))]
|
||||
debug: bool,
|
||||
#[clap(short = "v", default_value = "false", parse(try_from_str = "parse_bool"))]
|
||||
#[clap(
|
||||
short = "v",
|
||||
default_value = "false",
|
||||
parse(try_from_str = "parse_bool")
|
||||
)]
|
||||
verbose: bool,
|
||||
#[clap(short = "t", parse(try_from_str = "parse_bool"))]
|
||||
tribool: Option<bool>,
|
||||
|
|
Loading…
Reference in a new issue