1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

mkdir: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:01:16 +01:00
parent c8270b202e
commit 0e021e956a
2 changed files with 13 additions and 12 deletions

View file

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

View file

@ -96,7 +96,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// opts.optflag("Z", "context", "set SELinux security context" +
// " of each created directory to CTX"),
let matches = uu_app()
.usage(&usage[..])
.override_usage(&usage[..])
.after_help(&after_help[..])
.get_matches_from(args);
@ -110,35 +110,36 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
}
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(options::MODE)
.short("m")
Arg::new(options::MODE)
.short('m')
.long(options::MODE)
.help("set file mode (not implemented on windows)")
.default_value("755"),
)
.arg(
Arg::with_name(options::PARENTS)
.short("p")
Arg::new(options::PARENTS)
.short('p')
.long(options::PARENTS)
.alias("parent")
.help("make parent directories as needed"),
)
.arg(
Arg::with_name(options::VERBOSE)
.short("v")
Arg::new(options::VERBOSE)
.short('v')
.long(options::VERBOSE)
.help("print a message for each printed directory"),
)
.arg(
Arg::with_name(options::DIRS)
.multiple(true)
Arg::new(options::DIRS)
.multiple_occurrences(true)
.takes_value(true)
.min_values(1),
.min_values(1)
.allow_invalid_utf8(true),
)
}