pterm 0.0.5 → 0.0.7
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 +14 -1
- package/index.js +26 -1
- package/package.json +1 -1
- package/util.js +14 -0
package/README.md
CHANGED
|
@@ -14,8 +14,21 @@ npm install -g pterm
|
|
|
14
14
|
|
|
15
15
|
prints the current version
|
|
16
16
|
|
|
17
|
+
### syntax
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
pinokio version <type>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- `type`: may be `terminal`, `pinokiod`, or `pinokio`
|
|
24
|
+
- `terminal`: returns the pterm version
|
|
25
|
+
- `pinokiod`: returns the pinokiod version
|
|
26
|
+
- `pinokio`: returns the pinokio version
|
|
27
|
+
|
|
28
|
+
### example
|
|
29
|
+
|
|
17
30
|
```
|
|
18
|
-
pinokio version
|
|
31
|
+
pinokio version terminal
|
|
19
32
|
```
|
|
20
33
|
|
|
21
34
|
## start
|
package/index.js
CHANGED
|
@@ -12,8 +12,33 @@ const util = new Util();
|
|
|
12
12
|
let cmd = argv._[0].toLowerCase()
|
|
13
13
|
if (cmd === "push") {
|
|
14
14
|
let response = await util.push(argv)
|
|
15
|
+
} else if (cmd === "clipboard") {
|
|
16
|
+
await util.clipboard(argv)
|
|
15
17
|
} else if (cmd === "version") {
|
|
16
|
-
|
|
18
|
+
if (argv._.length > 1) {
|
|
19
|
+
let app = argv._[1]
|
|
20
|
+
if (app === "terminal") {
|
|
21
|
+
console.log("pterm@" + require('./package.json').version)
|
|
22
|
+
} else if (app === "pinokiod") {
|
|
23
|
+
try {
|
|
24
|
+
let r = await fetch("http://localhost:42000/pinokio/version").then((res) => {
|
|
25
|
+
return res.json()
|
|
26
|
+
})
|
|
27
|
+
console.log(`pinokiod@${r.pinokiod}`)
|
|
28
|
+
} catch (e) {
|
|
29
|
+
}
|
|
30
|
+
} else if (app === "pinokio") {
|
|
31
|
+
try {
|
|
32
|
+
let r = await fetch("http://localhost:42000/pinokio/version").then((res) => {
|
|
33
|
+
return res.json()
|
|
34
|
+
})
|
|
35
|
+
if (r.pinokio) {
|
|
36
|
+
console.log(`pinokiod@${r.pinokio}`)
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
17
42
|
} else if (cmd === "filepicker") {
|
|
18
43
|
await util.filepicker(argv)
|
|
19
44
|
} else if (cmd === "download") {
|
package/package.json
CHANGED
package/util.js
CHANGED
|
@@ -25,6 +25,20 @@ class Util {
|
|
|
25
25
|
}
|
|
26
26
|
})
|
|
27
27
|
}
|
|
28
|
+
async clipboard(argv) {
|
|
29
|
+
// pinokio clipboard copy <text>
|
|
30
|
+
// pinokio clipboard paste
|
|
31
|
+
if (argv._.length > 1) {
|
|
32
|
+
let payload = { type: argv._[1] }
|
|
33
|
+
if (argv._.length > 2) {
|
|
34
|
+
payload.text = argv._[2]
|
|
35
|
+
}
|
|
36
|
+
let response = await axios.post("http://localhost:42000/clipboard", payload)
|
|
37
|
+
if (response.data && response.data.text) {
|
|
38
|
+
console.log(response.data.text)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
28
42
|
async push(argv) {
|
|
29
43
|
if (argv._ && argv._.length > 1 && !argv.message) {
|
|
30
44
|
argv.message = argv._[1]
|