sync: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:55:13 +01:00
parent bad790840a
commit 57361292aa
2 changed files with 12 additions and 8 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/sync.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=["wide"] }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -165,7 +165,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 files: Vec<String> = matches
.values_of(ARG_FILES)
@ -194,25 +194,29 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(())
}
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::FILE_SYSTEM)
.short("f")
Arg::new(options::FILE_SYSTEM)
.short('f')
.long(options::FILE_SYSTEM)
.conflicts_with(options::DATA)
.help("sync the file systems that contain the files (Linux and Windows only)"),
)
.arg(
Arg::with_name(options::DATA)
.short("d")
Arg::new(options::DATA)
.short('d')
.long(options::DATA)
.conflicts_with(options::FILE_SYSTEM)
.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 {