mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
fix(yaml): adds support for loading author info from yaml
fix(yaml): adds support for loading author info from yaml
This commit is contained in:
parent
0d2a3f6ddb
commit
6bf5bf5bee
2 changed files with 15 additions and 0 deletions
|
@ -1460,6 +1460,7 @@ impl<'a> From<&'a Yaml> for App<'a, 'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
yaml_str!(a, yaml, version);
|
yaml_str!(a, yaml, version);
|
||||||
|
yaml_str!(a, yaml, author);
|
||||||
yaml_str!(a, yaml, bin_name);
|
yaml_str!(a, yaml, bin_name);
|
||||||
yaml_str!(a, yaml, about);
|
yaml_str!(a, yaml, about);
|
||||||
yaml_str!(a, yaml, before_help);
|
yaml_str!(a, yaml, before_help);
|
||||||
|
|
|
@ -24,3 +24,17 @@ fn help_message() {
|
||||||
assert!(help_string.contains(
|
assert!(help_string.contains(
|
||||||
"-h, --help prints help with a nonstandard description\n"));
|
"-h, --help prints help with a nonstandard description\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn author() {
|
||||||
|
let yml = load_yaml!("app.yml");
|
||||||
|
let mut app = App::from_yaml(yml);
|
||||||
|
// Generate the full help message!
|
||||||
|
let _ = app.get_matches_from_safe_borrow(Vec::<String>::new());
|
||||||
|
|
||||||
|
let mut help_buffer = Vec::new();
|
||||||
|
app.write_help(&mut help_buffer).unwrap();
|
||||||
|
let help_string = String::from_utf8(help_buffer).unwrap();
|
||||||
|
assert!(help_string.contains(
|
||||||
|
"Kevin K. <kbknapp@gmail.com>"));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue