1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 13:07:46 +00:00

ln: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 13:51:17 +01:00
parent 0531f13cfd
commit 9951958b93
2 changed files with 24 additions and 24 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/ln.rs" path = "src/ln.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"] } uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["fs"] }
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

@ -135,7 +135,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let long_usage = long_usage(); let long_usage = long_usage();
let matches = uu_app() let matches = uu_app()
.usage(&usage[..]) .override_usage(&usage[..])
.after_help(&*format!( .after_help(&*format!(
"{}\n{}", "{}\n{}",
long_usage, long_usage,
@ -179,30 +179,30 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
exec(&paths[..], &settings) exec(&paths[..], &settings)
} }
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(backup_control::arguments::backup()) .arg(backup_control::arguments::backup())
.arg(backup_control::arguments::backup_no_args()) .arg(backup_control::arguments::backup_no_args())
// TODO: opts.arg( // TODO: opts.arg(
// Arg::with_name(("d", "directory", "allow users with appropriate privileges to attempt \ // Arg::new(("d", "directory", "allow users with appropriate privileges to attempt \
// to make hard links to directories"); // to make hard links to directories");
.arg( .arg(
Arg::with_name(options::FORCE) Arg::new(options::FORCE)
.short("f") .short('f')
.long(options::FORCE) .long(options::FORCE)
.help("remove existing destination files"), .help("remove existing destination files"),
) )
.arg( .arg(
Arg::with_name(options::INTERACTIVE) Arg::new(options::INTERACTIVE)
.short("i") .short('i')
.long(options::INTERACTIVE) .long(options::INTERACTIVE)
.help("prompt whether to remove existing destination files"), .help("prompt whether to remove existing destination files"),
) )
.arg( .arg(
Arg::with_name(options::NO_DEREFERENCE) Arg::new(options::NO_DEREFERENCE)
.short("n") .short('n')
.long(options::NO_DEREFERENCE) .long(options::NO_DEREFERENCE)
.help( .help(
"treat LINK_NAME as a normal file if it is a \ "treat LINK_NAME as a normal file if it is a \
@ -210,13 +210,13 @@ pub fn uu_app() -> App<'static, 'static> {
), ),
) )
// TODO: opts.arg( // TODO: opts.arg(
// Arg::with_name(("L", "logical", "dereference TARGETs that are symbolic links"); // Arg::new(("L", "logical", "dereference TARGETs that are symbolic links");
// //
// TODO: opts.arg( // TODO: opts.arg(
// Arg::with_name(("P", "physical", "make hard links directly to symbolic links"); // Arg::new(("P", "physical", "make hard links directly to symbolic links");
.arg( .arg(
Arg::with_name(options::SYMBOLIC) Arg::new(options::SYMBOLIC)
.short("s") .short('s')
.long("symbolic") .long("symbolic")
.help("make symbolic links instead of hard links") .help("make symbolic links instead of hard links")
// override added for https://github.com/uutils/coreutils/issues/2359 // override added for https://github.com/uutils/coreutils/issues/2359
@ -224,35 +224,35 @@ pub fn uu_app() -> App<'static, 'static> {
) )
.arg(backup_control::arguments::suffix()) .arg(backup_control::arguments::suffix())
.arg( .arg(
Arg::with_name(options::TARGET_DIRECTORY) Arg::new(options::TARGET_DIRECTORY)
.short("t") .short('t')
.long(options::TARGET_DIRECTORY) .long(options::TARGET_DIRECTORY)
.help("specify the DIRECTORY in which to create the links") .help("specify the DIRECTORY in which to create the links")
.value_name("DIRECTORY") .value_name("DIRECTORY")
.conflicts_with(options::NO_TARGET_DIRECTORY), .conflicts_with(options::NO_TARGET_DIRECTORY),
) )
.arg( .arg(
Arg::with_name(options::NO_TARGET_DIRECTORY) Arg::new(options::NO_TARGET_DIRECTORY)
.short("T") .short('T')
.long(options::NO_TARGET_DIRECTORY) .long(options::NO_TARGET_DIRECTORY)
.help("treat LINK_NAME as a normal file always"), .help("treat LINK_NAME as a normal file always"),
) )
.arg( .arg(
Arg::with_name(options::RELATIVE) Arg::new(options::RELATIVE)
.short("r") .short('r')
.long(options::RELATIVE) .long(options::RELATIVE)
.help("create symbolic links relative to link location") .help("create symbolic links relative to link location")
.requires(options::SYMBOLIC), .requires(options::SYMBOLIC),
) )
.arg( .arg(
Arg::with_name(options::VERBOSE) Arg::new(options::VERBOSE)
.short("v") .short('v')
.long(options::VERBOSE) .long(options::VERBOSE)
.help("print name of each linked file"), .help("print name of each linked file"),
) )
.arg( .arg(
Arg::with_name(ARG_FILES) Arg::new(ARG_FILES)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.min_values(1), .min_values(1),