Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/uu/pr/src/pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(""),
Comment thread
ChrisDryden marked this conversation as resolved.
Outdated
)
.arg(
Arg::new(options::MERGE)
Expand Down
15 changes: 15 additions & 0 deletions tests/by-util/test_pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,18 @@ fn test_page_header_width() {
let regex = Regex::new(&pattern).unwrap();
new_ucmd!().pipe_in("a").succeeds().stdout_matches(&regex);
}

#[test]
fn test_separator_options_default_values() {
// -s and -S without arguments should use default values (TAB and empty string)
Comment thread
ChrisDryden marked this conversation as resolved.
Outdated
new_ucmd!()
.args(&["-t", "-2", "-s"])
.pipe_in("a\nb\n")
.succeeds()
.stdout_contains("\t");
new_ucmd!()
.args(&["-t", "-2", "-S"])
.pipe_in("a\nb\n")
.succeeds()
.stdout_does_not_contain("\t");
}
Comment thread
ChrisDryden marked this conversation as resolved.
Loading