mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
nl: re-add handling for -p/--no-renumber
This commit is contained in:
parent
7a6bd83859
commit
08e21e183b
2 changed files with 8 additions and 2 deletions
|
@ -297,7 +297,9 @@ fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
|
|||
|
||||
if let Some(new_style) = new_numbering_style {
|
||||
current_numbering_style = new_style;
|
||||
if settings.renumber {
|
||||
line_no = settings.starting_line_number;
|
||||
}
|
||||
println!();
|
||||
} else {
|
||||
let is_line_numbered = match current_numbering_style {
|
||||
|
|
|
@ -77,7 +77,11 @@ fn test_sections_and_styles() {
|
|||
#[test]
|
||||
fn test_no_renumber() {
|
||||
for arg in ["-p", "--no-renumber"] {
|
||||
new_ucmd!().arg(arg).succeeds();
|
||||
new_ucmd!()
|
||||
.arg(arg)
|
||||
.pipe_in("a\n\\:\\:\nb")
|
||||
.succeeds()
|
||||
.stdout_is(" 1\ta\n\n 2\tb\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue