"--group is useless without --long"

This commit is contained in:
Pascal Hertleif 2015-03-10 19:00:52 +01:00
parent cf38f90aa9
commit a4459da6ad

View File

@ -281,6 +281,9 @@ impl View {
else if matches.opt_present("tree") { else if matches.opt_present("tree") {
Err(Misfire::Useless("tree", false, "long")) Err(Misfire::Useless("tree", false, "long"))
} }
else if matches.opt_present("group") {
Err(Misfire::Useless("group", false, "long"))
}
else if matches.opt_present("level") && !matches.opt_present("recurse") { else if matches.opt_present("level") && !matches.opt_present("recurse") {
Err(Misfire::Useless2("level", "recurse", "tree")) Err(Misfire::Useless2("level", "recurse", "tree"))
} }
@ -629,6 +632,12 @@ mod test {
assert_eq!(opts.unwrap_err(), Misfire::Useless("header", false, "long")) assert_eq!(opts.unwrap_err(), Misfire::Useless("header", false, "long"))
} }
#[test]
fn just_group() {
let opts = Options::getopts(&[ "--group".to_string() ]);
assert_eq!(opts.unwrap_err(), Misfire::Useless("group", false, "long"))
}
#[test] #[test]
fn just_inode() { fn just_inode() {
let opts = Options::getopts(&[ "--inode".to_string() ]); let opts = Options::getopts(&[ "--inode".to_string() ]);