mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
refactor: simplify the code by using the clap function instead
This commit is contained in:
parent
e45c56b926
commit
29694212dd
3 changed files with 12 additions and 27 deletions
|
@ -63,7 +63,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
}
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
let mut cmd = Command::new(uucore::util_name())
|
||||
Command::new(uucore::util_name())
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
|
@ -126,12 +126,7 @@ pub fn uu_app() -> Command {
|
|||
.long(options::RECURSIVE)
|
||||
.help("operate on files and directories recursively")
|
||||
.action(ArgAction::SetTrue),
|
||||
);
|
||||
|
||||
)
|
||||
// Add common arguments with chgrp, chown & chmod
|
||||
for arg in uucore::perms::common_args() {
|
||||
cmd = cmd.arg(arg);
|
||||
}
|
||||
|
||||
cmd
|
||||
.args(uucore::perms::common_args())
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
}
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
let mut cmd = Command::new(uucore::util_name())
|
||||
Command::new(uucore::util_name())
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
|
@ -224,14 +224,9 @@ pub fn uu_app() -> Command {
|
|||
.required_unless_present(options::MODE)
|
||||
.action(ArgAction::Append)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
);
|
||||
|
||||
)
|
||||
// Add common arguments with chgrp, chown & chmod
|
||||
for arg in uucore::perms::common_args() {
|
||||
cmd = cmd.arg(arg);
|
||||
}
|
||||
|
||||
cmd
|
||||
.args(uucore::perms::common_args())
|
||||
}
|
||||
|
||||
struct Chmoder {
|
||||
|
|
|
@ -77,7 +77,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
}
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
let mut cmd = Command::new(uucore::util_name())
|
||||
Command::new(uucore::util_name())
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
|
@ -152,14 +152,9 @@ pub fn uu_app() -> Command {
|
|||
.short('v')
|
||||
.help("output a diagnostic for every file processed")
|
||||
.action(ArgAction::SetTrue),
|
||||
);
|
||||
|
||||
)
|
||||
// Add common arguments with chgrp, chown & chmod
|
||||
for arg in uucore::perms::common_args() {
|
||||
cmd = cmd.arg(arg);
|
||||
}
|
||||
|
||||
cmd
|
||||
.args(uucore::perms::common_args())
|
||||
}
|
||||
|
||||
/// Parses the user string to extract the UID.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue