jsir 1.2.6 → 1.2.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/cmd/ooa.js +16 -8
- package/package.json +1 -1
package/cmd/ooa.js
CHANGED
|
@@ -1019,16 +1019,24 @@ function getArgComments(argDef) {
|
|
|
1019
1019
|
return comments
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
|
-
async function runCmd(str) {
|
|
1022
|
+
async function runCmd(str, scriptName) {
|
|
1023
|
+
if (scriptName) {
|
|
1024
|
+
str = `0 ${str}`
|
|
1025
|
+
}
|
|
1023
1026
|
let strs = str.split(/\s+/)
|
|
1024
|
-
if (!
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1027
|
+
if (!scriptName) {
|
|
1028
|
+
if (!_cmdMap[strs[0]] && strs[0] !== '0') {
|
|
1029
|
+
warn('no items')
|
|
1030
|
+
_noAppendNextLine || nextLine()
|
|
1031
|
+
return
|
|
1032
|
+
}
|
|
1033
|
+
if (_cmdMap[strs[0]]) {
|
|
1034
|
+
scriptName = _cmdMap[strs[0]];
|
|
1035
|
+
}
|
|
1028
1036
|
}
|
|
1029
1037
|
|
|
1030
|
-
let path = _home + '/' +
|
|
1031
|
-
let text =
|
|
1038
|
+
let path = _home + '/' + scriptName
|
|
1039
|
+
let text = scriptName ? String(_fs.readFileSync(path)) : await getCbText()
|
|
1032
1040
|
|
|
1033
1041
|
let args = enrichArgs(str, text)
|
|
1034
1042
|
let argDef = getArgDef(text)
|
|
@@ -1073,7 +1081,7 @@ async function runCmd(str) {
|
|
|
1073
1081
|
|
|
1074
1082
|
process.argv = [process.argv[0], path, ...args]
|
|
1075
1083
|
try {
|
|
1076
|
-
await evalText(text, strs[0], _cmdMap[strs[0]], args)
|
|
1084
|
+
return await evalText(text, strs[0], _cmdMap[strs[0]], args)
|
|
1077
1085
|
} catch (e) {
|
|
1078
1086
|
error(e)
|
|
1079
1087
|
}
|