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:
CrazyMerlyn 2017-03-22 13:19:23 +05:30 committed by Kevin K
parent 0d2a3f6ddb
commit 6bf5bf5bee
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A
2 changed files with 15 additions and 0 deletions

View file

@ -1460,6 +1460,7 @@ impl<'a> From<&'a Yaml> for App<'a, 'a> {
}
yaml_str!(a, yaml, version);
yaml_str!(a, yaml, author);
yaml_str!(a, yaml, bin_name);
yaml_str!(a, yaml, about);
yaml_str!(a, yaml, before_help);

View file

@ -24,3 +24,17 @@ fn help_message() {
assert!(help_string.contains(
"-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>"));
}