We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66e8b67 commit 830d197Copy full SHA for 830d197
2 files changed
.gitignore
@@ -1 +1,4 @@
1
node_modules
2
+.DS_Store
3
+__pycache__/
4
+*.pyc
implement-shell-tools/cat/myCat.js
@@ -1,6 +1,5 @@
import { program } from "commander";
import { promises as fs } from "node:fs";
-import process from "node:process";
5
program
6
.name("myCat")
@@ -17,16 +16,15 @@ let lineNumber = 1;
17
16
18
for (const filename of files) {
19
const content = await fs.readFile(filename, "utf-8");
+ const lines = content.split("\n");
20
21
if (opts.n) {
22
- const lines = content.split("\n");
23
24
for (const line of lines) {
25
console.log(lineNumber + " " + line);
26
lineNumber++;
27
}
28
} else if (opts.b) {
29
30
31
32
if (line.trim() !== "") {
0 commit comments