@indah_sekar/loka 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/bin/cli.js +17 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,8 @@ loka --help
|
|
|
20
20
|
Output:
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
|
|
23
|
+
LokaIndex
|
|
24
|
+
Quick access to commands for Windows, Linux, macOS, networking, web development, security, and troubleshooting.
|
|
24
25
|
|
|
25
26
|
Usage:
|
|
26
27
|
loka [options] [command-id | command-name]
|
package/bin/cli.js
CHANGED
|
@@ -40,7 +40,8 @@ const FLAG_MAP = {
|
|
|
40
40
|
|
|
41
41
|
function printHelp() {
|
|
42
42
|
console.log(`
|
|
43
|
-
LokaIndex
|
|
43
|
+
LokaIndex
|
|
44
|
+
Quick access to commands for Windows, Linux, macOS, networking, web development, security, and troubleshooting.
|
|
44
45
|
|
|
45
46
|
Usage:
|
|
46
47
|
loka [options] [command-id | command-name]
|
|
@@ -162,7 +163,7 @@ function replacePlaceholders(command, defaultCmd, flagValues) {
|
|
|
162
163
|
result = result.replaceAll(placeholder, value);
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
for (const placeholder of Object.
|
|
166
|
+
for (const placeholder of Object.values(FLAG_MAP)) {
|
|
166
167
|
if (result.includes(placeholder)) {
|
|
167
168
|
hasUnresolved = true;
|
|
168
169
|
break;
|
|
@@ -235,14 +236,20 @@ function main() {
|
|
|
235
236
|
...Object.keys(FLAG_MAP),
|
|
236
237
|
]);
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
const skipIndices = new Set();
|
|
240
|
+
for (let i = 0; i < args.length; i++) {
|
|
241
|
+
if (skipArgs.has(args[i])) {
|
|
242
|
+
skipIndices.add(i);
|
|
243
|
+
if (i + 1 < args.length && args[i + 1] && !args[i + 1].startsWith("-")) {
|
|
244
|
+
skipIndices.add(i + 1);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (osFlag !== -1 && i === osFlag + 1) skipIndices.add(i);
|
|
248
|
+
if (catFlag !== -1 && i === catFlag + 1) skipIndices.add(i);
|
|
249
|
+
if (searchFlag !== -1 && i === searchFlag + 1) skipIndices.add(i);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
let filteredArgs = args.filter((_, i) => !skipIndices.has(i));
|
|
246
253
|
|
|
247
254
|
const isList = filteredArgs.includes("--list") || filteredArgs.includes("-l");
|
|
248
255
|
const query = filteredArgs.join(" ");
|
package/package.json
CHANGED