-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #894 - porglezomp:feature/customize-version-help, r=kbk…
…napp Allow customizing the --version and --help messages Fixes #889 This currently doesn't support customizing them from YAML, so it still needs some work.
- Loading branch information
Showing
5 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ about: tests clap library | |
author: Kevin K. <[email protected]> | ||
settings: | ||
- ArgRequiredElseHelp | ||
help_message: prints help with a nonstandard description | ||
args: | ||
- opt: | ||
short: o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,17 @@ FLAGS: | |
Prints version | ||
information"; | ||
|
||
static CUSTOM_VERSION_AND_HELP: &'static str = "customize 0.1 | ||
Nobody <[email protected]> | ||
You can customize the version and help text | ||
USAGE: | ||
customize | ||
FLAGS: | ||
-H, --help Print help information | ||
-v, --version Print version information"; | ||
|
||
#[test] | ||
fn help_short() { | ||
let m = App::new("test") | ||
|
@@ -529,3 +540,16 @@ fn issue_777_wrap_all_things() { | |
.set_term_width(35); | ||
assert!(test::compare_output(app, "ctest --help", ISSUE_777, false)); | ||
} | ||
|
||
#[test] | ||
fn customize_version_and_help() { | ||
let app = App::new("customize") | ||
.version("0.1") | ||
.author("Nobody <[email protected]>") | ||
.about("You can customize the version and help text") | ||
.help_short("H") | ||
.help_message("Print help information") | ||
.version_short("v") | ||
.version_message("Print version information"); | ||
assert!(test::compare_output(app, "customize --help", CUSTOM_VERSION_AND_HELP, false)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters