mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-13 10:37:58 +00:00
ch*: also remove duplications for deref & no deref
This commit is contained in:
parent
6de5aa7ac7
commit
e45c56b926
4 changed files with 31 additions and 41 deletions
|
@ -73,7 +73,7 @@ pub fn uu_app() -> Command {
|
||||||
Arg::new(options::HELP)
|
Arg::new(options::HELP)
|
||||||
.long(options::HELP)
|
.long(options::HELP)
|
||||||
.help("Print help information.")
|
.help("Print help information.")
|
||||||
.action(ArgAction::Help)
|
.action(ArgAction::Help),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::verbosity::CHANGES)
|
Arg::new(options::verbosity::CHANGES)
|
||||||
|
@ -101,20 +101,6 @@ pub fn uu_app() -> Command {
|
||||||
.help("output a diagnostic for every file processed")
|
.help("output a diagnostic for every file processed")
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
|
||||||
Arg::new(options::dereference::DEREFERENCE)
|
|
||||||
.long(options::dereference::DEREFERENCE)
|
|
||||||
.action(ArgAction::SetTrue),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::new(options::dereference::NO_DEREFERENCE)
|
|
||||||
.short('h')
|
|
||||||
.long(options::dereference::NO_DEREFERENCE)
|
|
||||||
.help(
|
|
||||||
"affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)",
|
|
||||||
)
|
|
||||||
.action(ArgAction::SetTrue),
|
|
||||||
)
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::preserve_root::PRESERVE)
|
Arg::new(options::preserve_root::PRESERVE)
|
||||||
.long(options::preserve_root::PRESERVE)
|
.long(options::preserve_root::PRESERVE)
|
||||||
|
@ -142,8 +128,8 @@ pub fn uu_app() -> Command {
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add traverse-related arguments
|
// Add common arguments with chgrp, chown & chmod
|
||||||
for arg in uucore::perms::traverse_args() {
|
for arg in uucore::perms::common_args() {
|
||||||
cmd = cmd.arg(arg);
|
cmd = cmd.arg(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ const USAGE: &str = help_usage!("chmod.md");
|
||||||
const LONG_USAGE: &str = help_section!("after help", "chmod.md");
|
const LONG_USAGE: &str = help_section!("after help", "chmod.md");
|
||||||
|
|
||||||
mod options {
|
mod options {
|
||||||
|
pub const HELP: &str = "help";
|
||||||
pub const CHANGES: &str = "changes";
|
pub const CHANGES: &str = "changes";
|
||||||
pub const QUIET: &str = "quiet"; // visible_alias("silent")
|
pub const QUIET: &str = "quiet"; // visible_alias("silent")
|
||||||
pub const VERBOSE: &str = "verbose";
|
pub const VERBOSE: &str = "verbose";
|
||||||
|
@ -158,6 +159,13 @@ pub fn uu_app() -> Command {
|
||||||
.args_override_self(true)
|
.args_override_self(true)
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
.no_binary_name(true)
|
.no_binary_name(true)
|
||||||
|
.disable_help_flag(true)
|
||||||
|
.arg(
|
||||||
|
Arg::new(options::HELP)
|
||||||
|
.long(options::HELP)
|
||||||
|
.help("Print help information.")
|
||||||
|
.action(ArgAction::Help),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::CHANGES)
|
Arg::new(options::CHANGES)
|
||||||
.long(options::CHANGES)
|
.long(options::CHANGES)
|
||||||
|
@ -218,8 +226,8 @@ pub fn uu_app() -> Command {
|
||||||
.value_hint(clap::ValueHint::AnyPath),
|
.value_hint(clap::ValueHint::AnyPath),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add traverse-related arguments
|
// Add common arguments with chgrp, chown & chmod
|
||||||
for arg in uucore::perms::traverse_args() {
|
for arg in uucore::perms::common_args() {
|
||||||
cmd = cmd.arg(arg);
|
cmd = cmd.arg(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,25 +96,6 @@ pub fn uu_app() -> Command {
|
||||||
.help("like verbose but report only when a change is made")
|
.help("like verbose but report only when a change is made")
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
|
||||||
Arg::new(options::dereference::DEREFERENCE)
|
|
||||||
.long(options::dereference::DEREFERENCE)
|
|
||||||
.help(
|
|
||||||
"affect the referent of each symbolic link (this is the default), \
|
|
||||||
rather than the symbolic link itself",
|
|
||||||
)
|
|
||||||
.action(ArgAction::SetTrue),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::new(options::dereference::NO_DEREFERENCE)
|
|
||||||
.short('h')
|
|
||||||
.long(options::dereference::NO_DEREFERENCE)
|
|
||||||
.help(
|
|
||||||
"affect symbolic links instead of any referenced file \
|
|
||||||
(useful only on systems that can change the ownership of a symlink)",
|
|
||||||
)
|
|
||||||
.action(ArgAction::SetTrue),
|
|
||||||
)
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::FROM)
|
Arg::new(options::FROM)
|
||||||
.long(options::FROM)
|
.long(options::FROM)
|
||||||
|
@ -173,8 +154,8 @@ pub fn uu_app() -> Command {
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add traverse-related arguments
|
// Add common arguments with chgrp, chown & chmod
|
||||||
for arg in uucore::perms::traverse_args() {
|
for arg in uucore::perms::common_args() {
|
||||||
cmd = cmd.arg(arg);
|
cmd = cmd.arg(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -636,7 +636,7 @@ pub fn chown_base(
|
||||||
executor.exec()
|
executor.exec()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn traverse_args() -> Vec<Arg> {
|
pub fn common_args() -> Vec<Arg> {
|
||||||
vec![
|
vec![
|
||||||
Arg::new(traverse::TRAVERSE)
|
Arg::new(traverse::TRAVERSE)
|
||||||
.short(traverse::TRAVERSE.chars().next().unwrap())
|
.short(traverse::TRAVERSE.chars().next().unwrap())
|
||||||
|
@ -653,6 +653,21 @@ pub fn traverse_args() -> Vec<Arg> {
|
||||||
.help("do not traverse any symbolic links (default)")
|
.help("do not traverse any symbolic links (default)")
|
||||||
.overrides_with_all([traverse::TRAVERSE, traverse::EVERY])
|
.overrides_with_all([traverse::TRAVERSE, traverse::EVERY])
|
||||||
.action(clap::ArgAction::SetTrue),
|
.action(clap::ArgAction::SetTrue),
|
||||||
|
Arg::new(options::dereference::DEREFERENCE)
|
||||||
|
.long(options::dereference::DEREFERENCE)
|
||||||
|
.help(
|
||||||
|
"affect the referent of each symbolic link (this is the default), \
|
||||||
|
rather than the symbolic link itself",
|
||||||
|
)
|
||||||
|
.action(clap::ArgAction::SetTrue),
|
||||||
|
Arg::new(options::dereference::NO_DEREFERENCE)
|
||||||
|
.short('h')
|
||||||
|
.long(options::dereference::NO_DEREFERENCE)
|
||||||
|
.help(
|
||||||
|
"affect symbolic links instead of any referenced file \
|
||||||
|
(useful only on systems that can change the ownership of a symlink)",
|
||||||
|
)
|
||||||
|
.action(clap::ArgAction::SetTrue),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue