mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
cut: fix formatting, use constant values
This commit is contained in:
parent
cfc3d52be4
commit
7e677b3e6c
2 changed files with 26 additions and 10 deletions
|
@ -494,7 +494,6 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
.long(options::COMPLEMENT)
|
.long(options::COMPLEMENT)
|
||||||
.help("invert the filter - instead of displaying only the filtered columns, display all but those columns")
|
.help("invert the filter - instead of displaying only the filtered columns, display all but those columns")
|
||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::ONLY_DELIMITED)
|
Arg::with_name(options::ONLY_DELIMITED)
|
||||||
|
@ -524,7 +523,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
)
|
)
|
||||||
.get_matches_from(args);
|
.get_matches_from(args);
|
||||||
|
|
||||||
let complement = matches.is_present("complement");
|
let complement = matches.is_present(options::COMPLEMENT);
|
||||||
|
|
||||||
let mode_parse = match (
|
let mode_parse = match (
|
||||||
matches.value_of(options::BYTES),
|
matches.value_of(options::BYTES),
|
||||||
|
@ -536,7 +535,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
Mode::Bytes(
|
Mode::Bytes(
|
||||||
ranges,
|
ranges,
|
||||||
Options {
|
Options {
|
||||||
out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()),
|
out_delim: Some(
|
||||||
|
matches
|
||||||
|
.value_of(options::OUTPUT_DELIMITER)
|
||||||
|
.unwrap_or_default()
|
||||||
|
.to_owned(),
|
||||||
|
),
|
||||||
zero_terminated: matches.is_present(options::ZERO_TERMINATED),
|
zero_terminated: matches.is_present(options::ZERO_TERMINATED),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -547,7 +551,12 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
Mode::Characters(
|
Mode::Characters(
|
||||||
ranges,
|
ranges,
|
||||||
Options {
|
Options {
|
||||||
out_delim: Some(matches.value_of(options::OUTPUT_DELIMITER).unwrap_or_default().to_owned()),
|
out_delim: Some(
|
||||||
|
matches
|
||||||
|
.value_of(options::OUTPUT_DELIMITER)
|
||||||
|
.unwrap_or_default()
|
||||||
|
.to_owned(),
|
||||||
|
),
|
||||||
zero_terminated: matches.is_present(options::ZERO_TERMINATED),
|
zero_terminated: matches.is_present(options::ZERO_TERMINATED),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -621,10 +630,18 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
let mode_parse = match mode_parse {
|
let mode_parse = match mode_parse {
|
||||||
Err(_) => mode_parse,
|
Err(_) => mode_parse,
|
||||||
Ok(mode) => match mode {
|
Ok(mode) => match mode {
|
||||||
Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("delimiter") => Err(
|
Mode::Bytes(_, _) | Mode::Characters(_, _)
|
||||||
msg_opt_only_usable_if!("printing a sequence of fields", "--delimiter", "-d"),
|
if matches.is_present(options::DELIMITER) =>
|
||||||
),
|
{
|
||||||
Mode::Bytes(_, _) | Mode::Characters(_, _) if matches.is_present("only-delimited") => {
|
Err(msg_opt_only_usable_if!(
|
||||||
|
"printing a sequence of fields",
|
||||||
|
"--delimiter",
|
||||||
|
"-d"
|
||||||
|
))
|
||||||
|
}
|
||||||
|
Mode::Bytes(_, _) | Mode::Characters(_, _)
|
||||||
|
if matches.is_present(options::ONLY_DELIMITED) =>
|
||||||
|
{
|
||||||
Err(msg_opt_only_usable_if!(
|
Err(msg_opt_only_usable_if!(
|
||||||
"printing a sequence of fields",
|
"printing a sequence of fields",
|
||||||
"--only-delimited",
|
"--only-delimited",
|
||||||
|
|
|
@ -80,8 +80,7 @@ fn print_version() {
|
||||||
fn print_usage(opts: &Options) {
|
fn print_usage(opts: &Options) {
|
||||||
let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \
|
let brief = "Run COMMAND, with modified buffering operations for its standard streams\n \
|
||||||
Mandatory arguments to long options are mandatory for short options too.";
|
Mandatory arguments to long options are mandatory for short options too.";
|
||||||
let explanation =
|
let explanation = "If MODE is 'L' the corresponding stream will be line buffered.\n \
|
||||||
"If MODE is 'L' the corresponding stream will be line buffered.\n \
|
|
||||||
This option is invalid with standard input.\n\n \
|
This option is invalid with standard input.\n\n \
|
||||||
If MODE is '0' the corresponding stream will be unbuffered.\n\n \
|
If MODE is '0' the corresponding stream will be unbuffered.\n\n \
|
||||||
Otherwise MODE is a number which may be followed by one of the following:\n\n \
|
Otherwise MODE is a number which may be followed by one of the following:\n\n \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue