Skip to content

Commit 56e2740

Browse files
SaraTahir28cyf
authored andcommitted
Adding implementation for the b flag
1 parent 007ee54 commit 56e2740

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ for (const file of files) {
2828
console.log(`${lineNumber.toString().padStart(6)} ${line}`); // adding padding for formatting
2929
lineNumber++;
3030
}
31-
else{
31+
else if (options.numberNonblank) { // -b
32+
if (line.trim() === "") {
33+
console.log(line);
34+
} else {
35+
console.log(`${lineNumber.toString().padStart(6)} ${line}`);
36+
lineNumber++;
37+
}
38+
} else {
3239
console.log(line);
3340
}
3441
}

0 commit comments

Comments
 (0)