gog-assistant 1.0.1 → 1.0.3
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/bin/index.js +20 -1
- package/package.json +2 -2
package/bin/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
async function
|
|
3
|
+
async function sendPost() {
|
|
4
4
|
try {
|
|
5
5
|
const response = await fetch("http://192.168.64.1:80", {
|
|
6
6
|
method: "POST",
|
|
@@ -14,6 +14,7 @@ async function main() {
|
|
|
14
14
|
|
|
15
15
|
const text = await response.text();
|
|
16
16
|
|
|
17
|
+
console.log("Request success");
|
|
17
18
|
console.log("Status:", response.status);
|
|
18
19
|
console.log("Response:", text);
|
|
19
20
|
} catch (err) {
|
|
@@ -22,4 +23,22 @@ async function main() {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
async function main() {
|
|
27
|
+
const args = process.argv.slice(2);
|
|
28
|
+
|
|
29
|
+
if (args.length === 0) {
|
|
30
|
+
console.log("Usage: quicktest-demo init");
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const command = args[0];
|
|
35
|
+
|
|
36
|
+
if (command === "init") {
|
|
37
|
+
await sendPost();
|
|
38
|
+
} else {
|
|
39
|
+
console.log(`Unknown command: ${command}`);
|
|
40
|
+
console.log("Usage: quicktest-demo init");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
25
44
|
main();
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gog-assistant",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A demo CLI tool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"gog-assistant": "./bin/index.js"
|
|
8
8
|
},
|
|
9
9
|
"type": "commonjs",
|
|
10
10
|
"license": "MIT"
|