mirror of
https://github.com/clap-rs/clap
synced 2024-12-15 07:12:32 +00:00
31 lines
905 B
Rust
31 lines
905 B
Rust
mod utils;
|
|
|
|
use clap::{App, Arg};
|
|
|
|
fn get_app() -> App<'static> {
|
|
App::new("myprog")
|
|
.arg(
|
|
Arg::new("GLOBAL_ARG")
|
|
.long("global-arg")
|
|
.about("Specifies something needed by the subcommands")
|
|
.global(true)
|
|
.takes_value(true)
|
|
.default_value("default_value"),
|
|
)
|
|
.arg(
|
|
Arg::new("GLOBAL_FLAG")
|
|
.long("global-flag")
|
|
.about("Specifies something needed by the subcommands")
|
|
.multiple(true)
|
|
.global(true),
|
|
)
|
|
.subcommand(App::new("outer").subcommand(App::new("inner")))
|
|
}
|
|
|
|
#[test]
|
|
fn issue_1076() {
|
|
let mut app = get_app();
|
|
let _ = app.try_get_matches_from_mut(vec!["myprog"]);
|
|
let _ = app.try_get_matches_from_mut(vec!["myprog"]);
|
|
let _ = app.try_get_matches_from_mut(vec!["myprog"]);
|
|
}
|