aaden-cli 1.3.22 → 1.3.23
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/dist/index.js +34 -32
- package/modules/cli-utils.js +33 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,48 +17,50 @@ const util = __nccwpck_require__(1669)
|
|
|
17
17
|
const colors = __nccwpck_require__(3045)
|
|
18
18
|
const {spawnSync} = __nccwpck_require__(3129)
|
|
19
19
|
|
|
20
|
-
function getLine
|
|
21
|
-
|
|
20
|
+
function getLine(char, lineLength = 20) {
|
|
21
|
+
return char.repeat(lineLength)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function commandBuilder
|
|
25
|
-
|
|
24
|
+
function commandBuilder(arr) {
|
|
25
|
+
return arr.join(' && ')
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function showCommand
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
function showCommand(arr) {
|
|
29
|
+
console.log(getLine('>'))
|
|
30
|
+
console.log(arr.join('\n').cyan)
|
|
31
|
+
console.log('')
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function executeInShell
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
function executeInShell(cmd, debug = false, needResult = false) {
|
|
35
|
+
let _cmd = commandBuilder(cmd)
|
|
36
|
+
try {
|
|
37
|
+
showCommand(cmd)
|
|
38
|
+
if (debug) {
|
|
39
|
+
return {
|
|
40
|
+
result: false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const res = spawnSync(_cmd, [], {
|
|
44
|
+
shell: true,
|
|
45
|
+
})
|
|
46
|
+
console.log(res.stdout)
|
|
47
|
+
return {
|
|
48
|
+
result: true,
|
|
49
|
+
output: res.stdout
|
|
50
|
+
}
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.log(getLine('*'))
|
|
53
|
+
console.log(e.bgRed)
|
|
54
|
+
console.log(_cmd)
|
|
55
|
+
console.log(getLine('*'))
|
|
42
56
|
}
|
|
43
|
-
return {
|
|
44
|
-
result: true,
|
|
45
|
-
...spawnSync(_cmd, [], {
|
|
46
|
-
shell: true,
|
|
47
|
-
stdio: needResult?'pipe':'inherit'
|
|
48
|
-
})}
|
|
49
|
-
} catch (e) {
|
|
50
|
-
console.log(getLine('*'))
|
|
51
|
-
console.log(e.bgRed)
|
|
52
|
-
console.log(_cmd)
|
|
53
57
|
console.log(getLine('*'))
|
|
54
|
-
|
|
55
|
-
console.log(getLine('*'))
|
|
56
|
-
return { result:false}
|
|
58
|
+
return {result: false}
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
module.exports = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
getLine,
|
|
63
|
+
executeInShell
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
|
|
@@ -89227,7 +89229,7 @@ module.exports = JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested"
|
|
|
89227
89229
|
/***/ ((module) => {
|
|
89228
89230
|
|
|
89229
89231
|
"use strict";
|
|
89230
|
-
module.exports = {"i8":"1.3.
|
|
89232
|
+
module.exports = {"i8":"1.3.22"};
|
|
89231
89233
|
|
|
89232
89234
|
/***/ }),
|
|
89233
89235
|
|
package/modules/cli-utils.js
CHANGED
|
@@ -2,46 +2,48 @@ const util = require('util')
|
|
|
2
2
|
const colors = require('colors')
|
|
3
3
|
const {spawnSync} = require('child_process')
|
|
4
4
|
|
|
5
|
-
function getLine
|
|
6
|
-
|
|
5
|
+
function getLine(char, lineLength = 20) {
|
|
6
|
+
return char.repeat(lineLength)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function commandBuilder
|
|
10
|
-
|
|
9
|
+
function commandBuilder(arr) {
|
|
10
|
+
return arr.join(' && ')
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function showCommand
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
function showCommand(arr) {
|
|
14
|
+
console.log(getLine('>'))
|
|
15
|
+
console.log(arr.join('\n').cyan)
|
|
16
|
+
console.log('')
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function executeInShell
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
function executeInShell(cmd, debug = false, needResult = false) {
|
|
20
|
+
let _cmd = commandBuilder(cmd)
|
|
21
|
+
try {
|
|
22
|
+
showCommand(cmd)
|
|
23
|
+
if (debug) {
|
|
24
|
+
return {
|
|
25
|
+
result: false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const res = spawnSync(_cmd, [], {
|
|
29
|
+
shell: true,
|
|
30
|
+
})
|
|
31
|
+
console.log(res.stdout)
|
|
32
|
+
return {
|
|
33
|
+
result: true,
|
|
34
|
+
output: res.stdout
|
|
35
|
+
}
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.log(getLine('*'))
|
|
38
|
+
console.log(e.bgRed)
|
|
39
|
+
console.log(_cmd)
|
|
40
|
+
console.log(getLine('*'))
|
|
27
41
|
}
|
|
28
|
-
return {
|
|
29
|
-
result: true,
|
|
30
|
-
...spawnSync(_cmd, [], {
|
|
31
|
-
shell: true,
|
|
32
|
-
stdio: needResult?'pipe':'inherit'
|
|
33
|
-
})}
|
|
34
|
-
} catch (e) {
|
|
35
42
|
console.log(getLine('*'))
|
|
36
|
-
|
|
37
|
-
console.log(_cmd)
|
|
38
|
-
console.log(getLine('*'))
|
|
39
|
-
}
|
|
40
|
-
console.log(getLine('*'))
|
|
41
|
-
return { result:false}
|
|
43
|
+
return {result: false}
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
module.exports = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
getLine,
|
|
48
|
+
executeInShell
|
|
47
49
|
}
|