Skip to content

Commit 3705174

Browse files
committed
stty: add support for tabs/-tabs combination settings
1 parent 33745a0 commit 3705174

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/uu/stty/src/flags.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,5 @@ pub const COMBINATION_SETTINGS: &[(&str, bool)] = &[
370370
("pass8", true),
371371
("raw", true),
372372
("sane", false),
373+
("tabs", true),
373374
];

src/uu/stty/src/stty.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,12 @@ fn combo_to_flags(combo: &str) -> Vec<ArgOptions<'_>> {
12201220
(S::VDISCARD, "^O"),
12211221
];
12221222
}
1223+
"tabs" => {
1224+
flags = vec!["tab0"];
1225+
}
1226+
"-tabs" => {
1227+
flags = vec!["tab3"];
1228+
}
12231229
_ => unreachable!("invalid combination setting: must have been caught earlier"),
12241230
}
12251231
let mut flags = flags

tests/by-util/test_stty.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,23 @@ fn test_combo_crt() {
951951
.stdout_contains("echoe");
952952
}
953953

954+
#[test]
955+
#[cfg(unix)]
956+
fn test_combo_tabs() {
957+
// Test tabs combination setting - tabs is an alias for tab0, -tabs for tab3
958+
new_ucmd!()
959+
.terminal_simulation(true)
960+
.args(&["tabs"])
961+
.succeeds()
962+
.no_stderr();
963+
964+
new_ucmd!()
965+
.terminal_simulation(true)
966+
.args(&["-tabs"])
967+
.succeeds()
968+
.no_stderr();
969+
}
970+
954971
#[test]
955972
#[cfg(unix)]
956973
#[ignore = "Fails because cargo test does not run in a tty"]

0 commit comments

Comments
 (0)