Skip to content

Commit adf7c2b

Browse files
Refactor options in 'wc' command for clarity and consistency.
Add package.json and package-lock.json for dependency management
1 parent 13fab23 commit adf7c2b

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

implement-shell-tools/cat/cat.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { program } from "commander";
22
import { promises as fs } from "node:fs";
33
import process from "node:process";
44

5-
// configure the CLI program with its name, description, arguments, options, and actions (the help instructions)
65
// configure the CLI program with its name, description, arguments, options, and actions (the help instructions)
76
program
87
.name("cat")

implement-shell-tools/package-lock.json

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

implement-shell-tools/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "implement-shell-tools",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"dependencies": {
6+
"commander": "^14.0.2"
7+
}
8+
}

implement-shell-tools/wc/wc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ program
77
.name("wc")
88
.description("An alternative to the 'wc' command")
99
.argument("<files...>", "The file(s) to count lines/words/bytes")
10-
.option("-l", "Count lines")
11-
.option("-w", "Count words")
12-
.option("-c", "Count bytes")
10+
.option("-l", "--lines", "Print the newline counts")
11+
.option("-w", "--words", "Print the word counts")
12+
.option("-c", "--bytes", "Print the byte counts")
1313
.action(async (files, options) => {
1414
try {
1515
// call newWc for all files

0 commit comments

Comments
 (0)