mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
pr: add default values for -s and -S separator options (#10073)
* pr: add default values for -s and -S separator options * pr: fix -S default value to space, simplify test
This commit is contained in:
+6
-2
@@ -276,14 +276,18 @@ pub fn uu_app() -> Command {
|
||||
.short('s')
|
||||
.long(options::COLUMN_CHAR_SEPARATOR)
|
||||
.help(translate!("pr-help-column-char-separator"))
|
||||
.value_name("char"),
|
||||
.value_name("char")
|
||||
.num_args(0..=1)
|
||||
.default_missing_value("\t"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::COLUMN_STRING_SEPARATOR)
|
||||
.short('S')
|
||||
.long(options::COLUMN_STRING_SEPARATOR)
|
||||
.help(translate!("pr-help-column-string-separator"))
|
||||
.value_name("string"),
|
||||
.value_name("string")
|
||||
.num_args(0..=1)
|
||||
.default_missing_value(" "),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::MERGE)
|
||||
|
||||
@@ -627,3 +627,17 @@ fn test_page_header_width() {
|
||||
let regex = Regex::new(&pattern).unwrap();
|
||||
new_ucmd!().pipe_in("a").succeeds().stdout_matches(®ex);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_separator_options_default_values() {
|
||||
// -s and -S without arguments should use default values (TAB and space)
|
||||
// TODO: verify output matches GNU pr behavior
|
||||
new_ucmd!()
|
||||
.args(&["-t", "-2", "-s"])
|
||||
.pipe_in("a\nb\n")
|
||||
.succeeds();
|
||||
new_ucmd!()
|
||||
.args(&["-t", "-2", "-S"])
|
||||
.pipe_in("a\nb\n")
|
||||
.succeeds();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user