You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: implement-shell-tools/cat/cat.js
+22-10Lines changed: 22 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -4,23 +4,35 @@ import { promises as fs } from "node:fs";
4
4
5
5
letshowNumber=false;
6
6
7
-
program.name("cat").description("Prints the output of a file to the console").option("-n, --number","Displays the lines along with their number").argument("<path>","The file path").allowExcessArguments()
8
-
program.parse()
7
+
program
8
+
.name("cat")
9
+
.description("Prints the output of a file to the console")
10
+
.option("-n, --number","Displays the lines along with their number")
11
+
.argument("<path>","The file path")
12
+
.allowExcessArguments();
13
+
program.parse();
9
14
10
-
constargv=program.args
15
+
constargv=program.args;
11
16
if(argv.length<1){
12
-
console.error(`Expected exactly 1 or more arguments (paths) to be passed but got ${argv.length}.`);
13
-
process.exit(1);
17
+
console.error(
18
+
`Expected exactly 1 or more arguments (paths) to be passed but got ${argv.length}.`,
program.name("list-directory-contents").description("Shows all files and folders in a directory").option("-1","List one file/directory per line").option("-a, --all","Show hidden files").argument("[path]","Path of the directory to list (defaults to .)")
8
+
program
9
+
.name("list-directory-contents")
10
+
.description("Shows all files and folders in a directory")
11
+
.option("-1","List one file/directory per line")
12
+
.option("-a, --all","Show hidden files")
13
+
.argument("[path]","Path of the directory to list (defaults to .)");
0 commit comments