-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: updates examples for 2x release
Closes #394
- Loading branch information
Showing
9 changed files
with
40 additions
and
36 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 |
---|---|---|
|
@@ -36,12 +36,12 @@ fn main() { | |
.version("1.0") | ||
.author("Kevin K. <[email protected]>") | ||
.about("Does awesome things") | ||
.args_from_usage("-c --config=[conf] 'Sets a custom config file' | ||
[output] 'Sets an optional output file' | ||
[debug]... -d 'Turn debugging information on'") | ||
.args_from_usage("-c, --config=[FILE] 'Sets a custom config file' | ||
<output> 'Sets an optional output file' | ||
-d... 'Turn debugging information on'") | ||
.subcommand(SubCommand::with_name("test") | ||
.about("does testing things") | ||
.arg_from_usage("[list] -l 'lists test values'")) | ||
.arg_from_usage("-l, --list 'lists test values'")) | ||
.get_matches(); | ||
|
||
// You can check the value provided by positional arguments, or option arguments | ||
|
@@ -55,7 +55,7 @@ fn main() { | |
|
||
// You can see how many times a particular flag or argument occurred | ||
// Note, only flags can have multiple occurrences | ||
match matches.occurrences_of("debug") { | ||
match matches.occurrences_of("d") { | ||
0 => println!("Debug mode is off"), | ||
1 => println!("Debug mode is kind of on"), | ||
2 => println!("Debug mode is on"), | ||
|
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 |
---|---|---|
|
@@ -15,9 +15,9 @@ fn main() { | |
// and args_from_usage() (as well as subcommands via the subcommand() and subcommands() methods) which | ||
// will be covered later. | ||
// | ||
// Once all options have been set, call .get_matches() in order to start the parsing and find all valid | ||
// command line arguments that supplied by the user at runtime. The name given to new() will be displayed | ||
// when the version or help flags are used. | ||
// Once all options have been set, call one of the .get_matches* family of methods in order to | ||
// start the parsing and find all valid command line arguments that supplied by the user at | ||
// runtime. The name given to new() will be displayed when the version or help flags are used. | ||
App::new("MyApp") | ||
.version("1.0") | ||
.author("Kevin K. <[email protected]>") | ||
|
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
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