Skip to content

Commit 14d4d33

Browse files
committed
updated flag a
1 parent fce72f0 commit 14d4d33

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

  • implement-shell-tools/ls

‎implement-shell-tools/ls/ls.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ function invalidFlagError() {
6060
process.exit(1);
6161
}
6262

63-
function Flag1(outputString) {
64-
if (printInList) return outputString.replaceAll("\t", "\n").replaceAll("\n\n", "\n");
65-
else printInList = true;
63+
function Flag1() {
64+
printInList = true;
6665
}
6766

6867
function Flaga() {
@@ -128,6 +127,10 @@ function removeDotFiles(fileList) {
128127

129128
function print(outputString) {
130129
let output = outputString;
131-
if (printInList) output = Flag1(output);
130+
if (printInList) output = makeList(output);
132131
console.log(output.trimEnd());
133132
}
133+
134+
function makeList(outputString) {
135+
return outputString.replaceAll("\t", "\n").replaceAll("\n\n", "\n");
136+
}

0 commit comments

Comments
 (0)