mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
Make all examples compile & run without failure.
This commit is contained in:
parent
6a56a82629
commit
b41384d320
5 changed files with 6 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue