1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +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" path = "src/mkdir.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["fs", "mode"] } uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["fs", "mode"] }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } 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" + // opts.optflag("Z", "context", "set SELinux security context" +
// " of each created directory to CTX"), // " of each created directory to CTX"),
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&after_help[..]) .after_help(&after_help[..])
.get_matches_from(args); .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()) App::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.arg( .arg(
Arg::with_name(options::MODE) Arg::new(options::MODE)
.short("m") .short('m')
.long(options::MODE) .long(options::MODE)
.help("set file mode (not implemented on windows)") .help("set file mode (not implemented on windows)")
.default_value("755"), .default_value("755"),
) )
.arg( .arg(
Arg::with_name(options::PARENTS) Arg::new(options::PARENTS)
.short("p") .short('p')
.long(options::PARENTS) .long(options::PARENTS)
.alias("parent") .alias("parent")
.help("make parent directories as needed"), .help("make parent directories as needed"),
) )
.arg( .arg(
Arg::with_name(options::VERBOSE) Arg::new(options::VERBOSE)
.short("v") .short('v')
.long(options::VERBOSE) .long(options::VERBOSE)
.help("print a message for each printed directory"), .help("print a message for each printed directory"),
) )
.arg( .arg(
Arg::with_name(options::DIRS) Arg::new(options::DIRS)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.min_values(1), .min_values(1)
.allow_invalid_utf8(true),
) )
} }