1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-17 12:16:17 +00:00

rmdir: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:41:24 +01:00
parent 283973c5bf
commit f260f60093
2 changed files with 13 additions and 17 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/rmdir.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
libc = "0.2.42"

View file

@ -33,7 +33,7 @@ fn usage() -> String {
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
let opts = Opts {
ignore: matches.is_present(OPT_IGNORE_FAIL_NON_EMPTY),
@ -175,35 +175,31 @@ struct Opts {
verbose: bool,
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.arg(
Arg::with_name(OPT_IGNORE_FAIL_NON_EMPTY)
Arg::new(OPT_IGNORE_FAIL_NON_EMPTY)
.long(OPT_IGNORE_FAIL_NON_EMPTY)
.help("ignore each failure that is solely because a directory is non-empty"),
)
.arg(
Arg::with_name(OPT_PARENTS)
.short("p")
.long(OPT_PARENTS)
.help(
.arg(Arg::new(OPT_PARENTS).short('p').long(OPT_PARENTS).help(
"remove DIRECTORY and its ancestors; e.g.,
'rmdir -p a/b/c' is similar to rmdir a/b/c a/b a",
),
)
))
.arg(
Arg::with_name(OPT_VERBOSE)
.short("v")
Arg::new(OPT_VERBOSE)
.short('v')
.long(OPT_VERBOSE)
.help("output a diagnostic for every directory processed"),
)
.arg(
Arg::with_name(ARG_DIRS)
.multiple(true)
Arg::new(ARG_DIRS)
.multiple_occurrences(true)
.takes_value(true)
.min_values(1)
.required(true),
.required(true)
.allow_invalid_utf8(true),
)
}