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