mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #3667 from cakebaker/set_default_missing_value
uniq: set default missing value for "group" and "all-repeated" args
This commit is contained in:
commit
f6a88552ab
2 changed files with 35 additions and 1 deletions
|
@ -319,7 +319,9 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.help("print all duplicate lines. Delimiting is done with blank lines. [default: none]")
|
.help("print all duplicate lines. Delimiting is done with blank lines. [default: none]")
|
||||||
.value_name("delimit-method")
|
.value_name("delimit-method")
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.max_values(1),
|
.max_values(1)
|
||||||
|
.default_missing_value("none")
|
||||||
|
.require_equals(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::GROUP)
|
Arg::new(options::GROUP)
|
||||||
|
@ -334,6 +336,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.value_name("group-method")
|
.value_name("group-method")
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.max_values(1)
|
.max_values(1)
|
||||||
|
.default_missing_value("separate")
|
||||||
|
.require_equals(true)
|
||||||
.conflicts_with_all(&[
|
.conflicts_with_all(&[
|
||||||
options::REPEATED,
|
options::REPEATED,
|
||||||
options::ALL_REPEATED,
|
options::ALL_REPEATED,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
// spell-checker:ignore nabcd
|
// spell-checker:ignore nabcd
|
||||||
use crate::common::util::*;
|
use crate::common::util::*;
|
||||||
|
|
||||||
|
@ -86,6 +88,20 @@ fn test_stdin_all_repeated() {
|
||||||
.stdout_is_fixture("sorted-all-repeated.expected");
|
.stdout_is_fixture("sorted-all-repeated.expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_all_repeated_followed_by_filename() {
|
||||||
|
let filename = "test.txt";
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
|
||||||
|
let mut file = at.make_file(filename);
|
||||||
|
file.write_all(b"a\na\n").unwrap();
|
||||||
|
|
||||||
|
ucmd.args(&["--all-repeated", filename])
|
||||||
|
.run()
|
||||||
|
.success()
|
||||||
|
.stdout_is("a\na\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_stdin_all_repeated_separate() {
|
fn test_stdin_all_repeated_separate() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
@ -160,6 +176,20 @@ fn test_group() {
|
||||||
.stdout_is_fixture("group.expected");
|
.stdout_is_fixture("group.expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_group_followed_by_filename() {
|
||||||
|
let filename = "test.txt";
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
|
||||||
|
let mut file = at.make_file(filename);
|
||||||
|
file.write_all(b"a\na\n").unwrap();
|
||||||
|
|
||||||
|
ucmd.args(&["--group", filename])
|
||||||
|
.run()
|
||||||
|
.success()
|
||||||
|
.stdout_is("a\na\n");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_group_prepend() {
|
fn test_group_prepend() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue