Make all examples compile & run without failure.

This commit is contained in:
Matt Kantor 2020-08-17 10:07:57 -07:00
parent 6a56a82629
commit b41384d320
5 changed files with 6 additions and 10 deletions

View file

@ -41,7 +41,6 @@ fn main() {
.long("config"),
Arg::new("input")
.about("the input file to use")
.index(1)
.required(true),
])
// *Note* the following two examples are convenience methods, if you wish

View file

@ -29,9 +29,8 @@ fn main() {
// also has a conflicts_with_all(Vec<&str>)
// and an exclusive(true)
)
// NOTE: In order to compile this example, comment out requires() and
// conflicts_with() because we have not defined an "output" or "config"
// argument.
.arg("-c, --config=[FILE] 'sets a custom config file'")
.arg("<output> 'sets an output file'")
.get_matches();
// We can find out whether or not awesome was used

View file

@ -33,8 +33,7 @@ fn main() {
// requires "config"
// Note, we also do not need to specify requires("input")
// because requires lists are automatically two-way
// NOTE: In order to compile this example, comment out conflicts_with()
// because we have not defined an "output" argument.
.arg(Arg::new("output").about("the output file to use").index(3))
.get_matches();
// We can find out whether or not "input" or "config" were used

View file

@ -33,9 +33,8 @@ fn main() {
// also has a conflicts_with_all(Vec<&str>)
// and an exclusive(true)
)
// NOTE: In order to compile this example, comment out conflicts_with()
// and requires() because we have not defined an "output" or "config"
// argument.
.arg("-c, --config=[FILE] 'the config file to use'")
.arg("<output> 'the output file to use'")
.get_matches();
// We can find out whether or not "input" was used

View file

@ -34,7 +34,7 @@ fn main() {
.group(
ArgGroup::new("vers")
.required(true)
.args(&["ver", "major", "minor", "patch"]),
.args(&["set-ver", "major", "minor", "patch"]),
)
// Arguments can also be added to a group individually, these two arguments
// are part of the "input" group which is not required