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 1a27139 commit 667e3bbCopy full SHA for 667e3bb
1 file changed
implement-shell-tools/ls/ls.js
@@ -7,22 +7,20 @@ const flags = new Set();
7
let paths = [];
8
9
let isFlag = true;
10
-for (let i = 0; i < args.length; i++) {
11
- if (isFlag && args[i] === "--") {
+for (const arg of args) {
+ if (isFlag && arg === "--") {
12
isFlag = false;
13
- } else if (isFlag && args[i].startsWith("-") && args[i] !== "-") {
+ } else if (isFlag && arg.startsWith("-") && arg !== "-") {
14
// capture the flags without the -
15
// supports combined flags like -1a
16
- for (const ch of args[i].slice(1)) {
+ for (const ch of arg.slice(1)) {
17
flags.add(ch);
18
}
19
} else {
20
- paths.push(args[i]);
+ paths.push(arg);
21
22
23
24
-console.log(paths);
25
-
26
if (paths.length === 0) {
27
paths.push(".");
28
0 commit comments