clap/tests/hidden_args.rs

37 lines
886 B
Rust
Raw Normal View History

2015-10-01 03:34:23 +00:00
extern crate clap;
extern crate regex;
2015-10-01 03:34:23 +00:00
use clap::{App, Arg};
include!("../clap-test.rs");
2015-10-01 03:34:23 +00:00
static HIDDEN_ARGS: &'static str = "test 1.4
2015-10-01 03:34:23 +00:00
Kevin K.
tests stuff
USAGE:
2017-03-09 22:53:36 +00:00
test [FLAGS] [OPTIONS]
2015-10-01 03:34:23 +00:00
FLAGS:
-F, --flag2 some other flag
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--option <opt> some option";
#[test]
fn hidden_args() {
let app = App::new("test")
.author("Kevin K.")
.about("tests stuff")
.version("1.4")
2018-01-25 04:05:05 +00:00
.args(&[
Arg::from_usage("-f, --flag 'some flag'").hidden(true),
Arg::from_usage("-F, --flag2 'some other flag'"),
Arg::from_usage("--option [opt] 'some option'"),
Arg::with_name("DUMMY").required(false).hidden(true),
]);
assert!(test::compare_output(app, "test --help", HIDDEN_ARGS, false));
2015-10-01 03:34:23 +00:00
}