mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
sync: clap 3
This commit is contained in:
parent
bad790840a
commit
57361292aa
2 changed files with 12 additions and 8 deletions
|
@ -15,7 +15,7 @@ edition = "2018"
|
||||||
path = "src/sync.rs"
|
path = "src/sync.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=["wide"] }
|
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["wide"] }
|
||||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||||
|
|
|
@ -165,7 +165,7 @@ fn usage() -> String {
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let usage = usage();
|
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 files: Vec<String> = matches
|
let files: Vec<String> = matches
|
||||||
.values_of(ARG_FILES)
|
.values_of(ARG_FILES)
|
||||||
|
@ -194,25 +194,29 @@ 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::FILE_SYSTEM)
|
Arg::new(options::FILE_SYSTEM)
|
||||||
.short("f")
|
.short('f')
|
||||||
.long(options::FILE_SYSTEM)
|
.long(options::FILE_SYSTEM)
|
||||||
.conflicts_with(options::DATA)
|
.conflicts_with(options::DATA)
|
||||||
.help("sync the file systems that contain the files (Linux and Windows only)"),
|
.help("sync the file systems that contain the files (Linux and Windows only)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::DATA)
|
Arg::new(options::DATA)
|
||||||
.short("d")
|
.short('d')
|
||||||
.long(options::DATA)
|
.long(options::DATA)
|
||||||
.conflicts_with(options::FILE_SYSTEM)
|
.conflicts_with(options::FILE_SYSTEM)
|
||||||
.help("sync only file data, no unneeded metadata (Linux only)"),
|
.help("sync only file data, no unneeded metadata (Linux only)"),
|
||||||
)
|
)
|
||||||
.arg(Arg::with_name(ARG_FILES).multiple(true).takes_value(true))
|
.arg(
|
||||||
|
Arg::new(ARG_FILES)
|
||||||
|
.multiple_occurrences(true)
|
||||||
|
.takes_value(true),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sync() -> isize {
|
fn sync() -> isize {
|
||||||
|
|
Loading…
Reference in a new issue