Skip to content

Commit ba120fa

Browse files
committed
fix: Align line numbers
1 parent 61122da commit ba120fa

File tree

1 file changed

+2
-2
lines changed
  • implement-shell-tools/cat

1 file changed

+2
-2
lines changed

implement-shell-tools/cat/cat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ for (const filePath of filePaths) {
2020

2121
for (const line of content.split("\n")) {
2222
if (options.n) {
23-
console.log(`${lineNumber} ${line}`);
23+
console.log(`${String(lineNumber).padStart(6, ' ')} ${line}`);
2424
lineNumber++;
2525
} else if (options.b) {
2626
if (line.trim()) {
27-
console.log(`${lineNumber} ${line}`);
27+
console.log(`${String(lineNumber).padStart(6, ' ')} ${line}`);
2828
lineNumber++;
2929
} else {
3030
console.log("");

0 commit comments

Comments
 (0)