Skip to content

Commit e2309f9

Browse files
authored
Merge pull request #9993 from ChrisDryden/pr-b-flag-compat
pr: add -b flag for backwards compatibility
2 parents c9099cb + 0e85a93 commit e2309f9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/uu/pr/src/pr.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ mod options {
4848
pub const COLUMN_WIDTH: &str = "width";
4949
pub const PAGE_WIDTH: &str = "page-width";
5050
pub const ACROSS: &str = "across";
51+
pub const COLUMN_DOWN: &str = "column-down";
5152
pub const COLUMN: &str = "column";
5253
pub const COLUMN_CHAR_SEPARATOR: &str = "separator";
5354
pub const COLUMN_STRING_SEPARATOR: &str = "sep-string";
@@ -257,6 +258,13 @@ pub fn uu_app() -> Command {
257258
.help(translate!("pr-help-across"))
258259
.action(ArgAction::SetTrue),
259260
)
261+
.arg(
262+
// -b is a no-op for backwards compatibility (column-down is now the default)
263+
Arg::new(options::COLUMN_DOWN)
264+
.short('b')
265+
.hide(true)
266+
.action(ArgAction::SetTrue),
267+
)
260268
.arg(
261269
Arg::new(options::COLUMN)
262270
.long(options::COLUMN)

tests/by-util/test_pr.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,9 @@ fn test_version() {
616616
fn test_pr_char_device_dev_null() {
617617
new_ucmd!().arg("/dev/null").succeeds();
618618
}
619+
620+
#[test]
621+
fn test_b_flag_backwards_compat() {
622+
// -b is a no-op for backwards compatibility (column-down is now the default)
623+
new_ucmd!().args(&["-b", "-t"]).pipe_in("a\nb\n").succeeds();
624+
}

0 commit comments

Comments
 (0)