Skip to content

Commit e155672

Browse files
committed
house keeping
1 parent 397d4e0 commit e155672

File tree

1 file changed

+12
-12
lines changed
  • implement-shell-tools/wc

1 file changed

+12
-12
lines changed

implement-shell-tools/wc/wc.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ if (pathInfo.isFile()) {
4444
const content = await fs.readFile(path, "utf-8");
4545
const stats = counter(content);
4646
if (options.line) {
47-
console.log(` ${stats.lines} ${path}`);
47+
console.log(`${stats.lines} ${path}`);
4848
} else if (options.word) {
49-
console.log(` ${stats.words} ${path}`);
49+
console.log(`${stats.words} ${path}`);
5050
} else if (options.character) {
51-
console.log(` ${stats.characters} ${path}`);
51+
console.log(`${stats.characters} ${path}`);
5252
} else {
53-
console.log(` ${stats.lines} ${stats.words} ${stats.characters} ${path}`);
53+
console.log(`${stats.lines} ${stats.words} ${stats.characters} ${path}`);
5454
}
5555

5656
totalLines += stats.lines;
@@ -66,13 +66,13 @@ if (pathInfo.isFile()) {
6666
const stats = counter(fileContent);
6767

6868
if (options.line) {
69-
console.log(` ${stats.lines} ${filePath}`);
69+
console.log(`${stats.lines} ${filePath}`);
7070
} else if (options.word) {
71-
console.log(` ${stats.words} ${filePath}`);
71+
console.log(`${stats.words} ${filePath}`);
7272
} else if (options.character) {
73-
console.log(` ${stats.characters} ${filePath}`);
73+
console.log(`${stats.characters} ${filePath}`);
7474
} else {
75-
console.log(` ${stats.lines} ${stats.words} ${stats.characters} ${path}`);
75+
console.log(`${stats.lines} ${stats.words} ${stats.characters} ${path}`);
7676
}
7777

7878
totalLines += stats.lines;
@@ -86,12 +86,12 @@ if (pathInfo.isFile()) {
8686

8787
if (fileCount > 1) {
8888
if (options.line) {
89-
console.log(` ${totalLines}`);
89+
console.log(`${totalLines} total`);
9090
} else if (options.word) {
91-
console.log(` ${totalWords}`);
91+
console.log(`${totalWords} total`);
9292
} else if (options.character) {
93-
console.log(` ${totalCharacters}`);
93+
console.log(`${totalCharacters} total`);
9494
} else {
95-
console.log(` ${totalLines} ${totalWords} ${totalCharacters}`);
95+
console.log(`${totalLines} ${totalWords} ${totalCharacters} total`);
9696
}
9797
}

0 commit comments

Comments
 (0)