This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from epage/revert
Revert "Deprecate Arg::help in favour of Arg::about"
- Loading branch information
Showing
69 changed files
with
590 additions
and
600 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,24 +222,24 @@ fn main() { | |
.short('c') | ||
.long("config") | ||
.value_name("FILE") | ||
.about("Sets a custom config file") | ||
.help("Sets a custom config file") | ||
.takes_value(true)) | ||
.arg(Arg::new("INPUT") | ||
.about("Sets the input file to use") | ||
.help("Sets the input file to use") | ||
.required(true) | ||
.index(1)) | ||
.arg(Arg::new("v") | ||
.short('v') | ||
.multiple_occurrences(true) | ||
.takes_value(true) | ||
.about("Sets the level of verbosity")) | ||
.help("Sets the level of verbosity")) | ||
.subcommand(App::new("test") | ||
.about("controls testing features") | ||
.version("1.3") | ||
.author("Someone E. <[email protected]>") | ||
.arg(Arg::new("debug") | ||
.short('d') | ||
.about("print debug information verbosely"))) | ||
.help("print debug information verbosely"))) | ||
.get_matches(); | ||
// You can check the value provided by positional arguments, or option arguments | ||
|
@@ -321,16 +321,16 @@ args: | |
short: c | ||
long: config | ||
value_name: FILE | ||
about: Sets a custom config file | ||
help: Sets a custom config file | ||
takes_value: true | ||
- INPUT: | ||
about: Sets the input file to use | ||
help: Sets the input file to use | ||
required: true | ||
index: 1 | ||
- verbose: | ||
short: v | ||
multiple_occurrences: true | ||
about: Sets the level of verbosity | ||
help: Sets the level of verbosity | ||
subcommands: | ||
- test: | ||
about: controls testing features | ||
|
@@ -340,7 +340,7 @@ subcommands: | |
- debug: | ||
short: d | ||
long: debug | ||
about: Print debug information | ||
help: Print debug information | ||
``` | ||
Since this feature requires additional dependencies that not everyone may want, it is *not* compiled in by default and we need to enable a feature flag in Cargo.toml: | ||
|
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 |
---|---|---|
|
@@ -54,32 +54,32 @@ pub fn build_from_builder(c: &mut Criterion) { | |
.author("Kevin K. <[email protected]>") | ||
.arg( | ||
Arg::new("opt") | ||
.about("tests options") | ||
.help("tests options") | ||
.short('o') | ||
.long("option") | ||
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences), | ||
) | ||
.arg(Arg::new("positional").about("tests positionals").index(1)) | ||
.arg(Arg::new("positional").help("tests positionals").index(1)) | ||
.arg( | ||
Arg::new("flag") | ||
.short('f') | ||
.about("tests flags") | ||
.help("tests flags") | ||
.long("flag") | ||
.global(true) | ||
.setting(ArgSettings::MultipleOccurrences), | ||
) | ||
.arg( | ||
Arg::new("flag2") | ||
.short('F') | ||
.about("tests flags with exclusions") | ||
.help("tests flags with exclusions") | ||
.conflicts_with("flag") | ||
.requires("option2"), | ||
) | ||
.arg( | ||
Arg::new("option2") | ||
.about("tests long options with exclusions") | ||
.help("tests long options with exclusions") | ||
.conflicts_with("option") | ||
.requires("positional2") | ||
.setting(ArgSettings::TakesValue) | ||
|
@@ -88,29 +88,29 @@ pub fn build_from_builder(c: &mut Criterion) { | |
.arg( | ||
Arg::new("positional2") | ||
.index(3) | ||
.about("tests positionals with exclusions"), | ||
.help("tests positionals with exclusions"), | ||
) | ||
.arg( | ||
Arg::new("option3") | ||
.short('O') | ||
.long("Option") | ||
.setting(ArgSettings::TakesValue) | ||
.about("tests options with specific value sets") | ||
.help("tests options with specific value sets") | ||
.possible_values(OPT3_VALS), | ||
) | ||
.arg( | ||
Arg::new("positional3") | ||
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences) | ||
.about("tests positionals with specific values") | ||
.help("tests positionals with specific values") | ||
.index(4) | ||
.possible_values(POS3_VALS), | ||
) | ||
.arg( | ||
Arg::new("multvals") | ||
.long("multvals") | ||
.about("Tests multiple values, not mult occs") | ||
.help("Tests multiple values, not mult occs") | ||
.value_names(&["one", "two"]), | ||
) | ||
.arg( | ||
|
@@ -119,7 +119,7 @@ pub fn build_from_builder(c: &mut Criterion) { | |
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences) | ||
.about("Tests multiple values, not mult occs") | ||
.help("Tests multiple values, not mult occs") | ||
.value_names(&["one", "two"]), | ||
) | ||
.arg( | ||
|
@@ -128,7 +128,7 @@ pub fn build_from_builder(c: &mut Criterion) { | |
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences) | ||
.about("Tests 2 min vals") | ||
.help("Tests 2 min vals") | ||
.min_values(2), | ||
) | ||
.arg( | ||
|
@@ -137,7 +137,7 @@ pub fn build_from_builder(c: &mut Criterion) { | |
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences) | ||
.about("Tests 3 max vals") | ||
.help("Tests 3 max vals") | ||
.max_values(3), | ||
) | ||
.subcommand( | ||
|
@@ -152,9 +152,9 @@ pub fn build_from_builder(c: &mut Criterion) { | |
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences) | ||
.about("tests options"), | ||
.help("tests options"), | ||
) | ||
.arg(Arg::new("scpositional").index(1).about("tests positionals")), | ||
.arg(Arg::new("scpositional").index(1).help("tests positionals")), | ||
) | ||
}) | ||
}); | ||
|
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 |
---|---|---|
|
@@ -36,17 +36,17 @@ fn app_example3<'c>() -> App<'c> { | |
App::new("MyApp") | ||
.arg( | ||
Arg::new("debug") | ||
.about("turn on debugging information") | ||
.help("turn on debugging information") | ||
.short('d'), | ||
) | ||
.args(&[ | ||
Arg::new("config") | ||
.about("sets the config file to use") | ||
.help("sets the config file to use") | ||
.setting(ArgSettings::TakesValue) | ||
.short('c') | ||
.long("config"), | ||
Arg::new("input") | ||
.about("the input file to use") | ||
.help("the input file to use") | ||
.index(1) | ||
.setting(ArgSettings::Required), | ||
]) | ||
|
@@ -62,19 +62,19 @@ fn app_example4<'c>() -> App<'c> { | |
.author("Kevin K. <[email protected]>") | ||
.arg( | ||
Arg::new("debug") | ||
.about("turn on debugging information") | ||
.help("turn on debugging information") | ||
.short('d') | ||
.long("debug"), | ||
) | ||
.arg( | ||
Arg::new("config") | ||
.about("sets the config file to use") | ||
.help("sets the config file to use") | ||
.short('c') | ||
.long("config"), | ||
) | ||
.arg( | ||
Arg::new("input") | ||
.about("the input file to use") | ||
.help("the input file to use") | ||
.index(1) | ||
.setting(ArgSettings::Required), | ||
) | ||
|
@@ -83,7 +83,7 @@ fn app_example4<'c>() -> App<'c> { | |
fn app_example5<'c>() -> App<'c> { | ||
App::new("MyApp").arg( | ||
Arg::new("awesome") | ||
.about("turns up the awesome") | ||
.help("turns up the awesome") | ||
.short('a') | ||
.long("awesome") | ||
.setting(ArgSettings::MultipleOccurrences) | ||
|
@@ -96,13 +96,13 @@ fn app_example6<'c>() -> App<'c> { | |
App::new("MyApp") | ||
.arg( | ||
Arg::new("input") | ||
.about("the input file to use") | ||
.help("the input file to use") | ||
.index(1) | ||
.requires("config") | ||
.conflicts_with("output") | ||
.setting(ArgSettings::Required), | ||
) | ||
.arg(Arg::new("config").about("the config file to use").index(2)) | ||
.arg(Arg::new("config").help("the config file to use").index(2)) | ||
} | ||
|
||
fn app_example7<'c>() -> App<'c> { | ||
|
@@ -111,7 +111,7 @@ fn app_example7<'c>() -> App<'c> { | |
.arg(Arg::new("output")) | ||
.arg( | ||
Arg::new("input") | ||
.about("the input file to use") | ||
.help("the input file to use") | ||
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences) | ||
|
@@ -129,7 +129,7 @@ fn app_example8<'c>() -> App<'c> { | |
.arg(Arg::new("output")) | ||
.arg( | ||
Arg::new("input") | ||
.about("the input file to use") | ||
.help("the input file to use") | ||
.setting(ArgSettings::TakesValue) | ||
.setting(ArgSettings::MultipleValues) | ||
.setting(ArgSettings::MultipleOccurrences) | ||
|
@@ -144,7 +144,7 @@ fn app_example8<'c>() -> App<'c> { | |
fn app_example10<'c>() -> App<'c> { | ||
App::new("myapp").about("does awesome things").arg( | ||
Arg::new("CONFIG") | ||
.about("The config file to use (default is \"config.json\")") | ||
.help("The config file to use (default is \"config.json\")") | ||
.short('c') | ||
.setting(ArgSettings::TakesValue), | ||
) | ||
|
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
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
Oops, something went wrong.