mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
pathchk: clap 3
This commit is contained in:
parent
8f7f3d18ee
commit
49b19972cc
2 changed files with 13 additions and 9 deletions
|
@ -15,7 +15,7 @@ edition = "2018"
|
||||||
path = "src/pathchk.rs"
|
path = "src/pathchk.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" }
|
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
|
||||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
.collect_str(InvalidEncodingHandling::ConvertLossy)
|
||||||
.accept_any();
|
.accept_any();
|
||||||
|
|
||||||
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
|
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
|
||||||
|
|
||||||
// set working mode
|
// set working mode
|
||||||
let is_posix = matches.values_of(options::POSIX).is_some();
|
let is_posix = matches.values_of(options::POSIX).is_some();
|
||||||
|
@ -88,26 +88,30 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
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::POSIX)
|
Arg::new(options::POSIX)
|
||||||
.short("p")
|
.short('p')
|
||||||
.help("check for most POSIX systems"),
|
.help("check for most POSIX systems"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::POSIX_SPECIAL)
|
Arg::new(options::POSIX_SPECIAL)
|
||||||
.short("P")
|
.short('P')
|
||||||
.help(r#"check for empty names and leading "-""#),
|
.help(r#"check for empty names and leading "-""#),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::PORTABILITY)
|
Arg::new(options::PORTABILITY)
|
||||||
.long(options::PORTABILITY)
|
.long(options::PORTABILITY)
|
||||||
.help("check for all POSIX systems (equivalent to -p -P)"),
|
.help("check for all POSIX systems (equivalent to -p -P)"),
|
||||||
)
|
)
|
||||||
.arg(Arg::with_name(options::PATH).hidden(true).multiple(true))
|
.arg(
|
||||||
|
Arg::new(options::PATH)
|
||||||
|
.hide(true)
|
||||||
|
.multiple_occurrences(true),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check a path, given as a slice of it's components and an operating mode
|
// check a path, given as a slice of it's components and an operating mode
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue