mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
use match guard to minimize
This commit is contained in:
parent
50c8bd4c6b
commit
f334ae3149
1 changed files with 29 additions and 30 deletions
|
@ -551,11 +551,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
let zero_terminated = matches.get_flag(options::ZERO_TERMINATED);
|
||||
|
||||
match matches.get_one::<String>(options::DELIMITER).map(|s| s.as_str()) {
|
||||
Some(mut delim) => {
|
||||
if whitespace_delimited {
|
||||
Some(_) if whitespace_delimited => {
|
||||
Err("invalid input: Only one of --delimiter (-d) or -w option can be specified".into())
|
||||
}
|
||||
else {
|
||||
Some(mut delim) => {
|
||||
// GNU's `cut` supports `-d=` to set the delimiter to `=`.
|
||||
// Clap parsing is limited in this situation, see:
|
||||
// https://github.com/uutils/coreutils/issues/2424#issuecomment-863825242
|
||||
|
@ -586,7 +585,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None => Ok(Mode::Fields(
|
||||
ranges,
|
||||
FieldOptions {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue