jsir 2.5.0 → 2.5.1
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/oaa.js +28 -29
- package/deps/room.js +1 -0
- package/deps/util.js +2 -2
- package/package.json +1 -1
package/cmd/oaa.js
CHANGED
|
@@ -585,8 +585,7 @@ function wrapperAlias(str) {
|
|
|
585
585
|
return str;
|
|
586
586
|
}
|
|
587
587
|
let fstr = str.split(/\s+/)[0];
|
|
588
|
-
|
|
589
|
-
return [fstr, str.substring(fstr.length)].map(trim).filter(i => i).join(' ')
|
|
588
|
+
return [getAlias(aliasMap, fstr), str.substring(fstr.length)].map(trim).filter(i => i).join(' ')
|
|
590
589
|
}
|
|
591
590
|
|
|
592
591
|
async function _wrapperInput(str) {
|
|
@@ -1405,13 +1404,11 @@ const keywordDef = {
|
|
|
1405
1404
|
}
|
|
1406
1405
|
}
|
|
1407
1406
|
let pair = parseUniqueName(keyword)
|
|
1408
|
-
let cmds
|
|
1409
|
-
if (
|
|
1410
|
-
cmds = getQuickRunCmds(keyword,
|
|
1411
|
-
} else {
|
|
1412
|
-
cmds = getQuickRunCmds(keyword, '^e ' + toJsirFileName(pair[1]) + '$')
|
|
1407
|
+
let cmds = getQuickRunCmds(keyword, pair[1])
|
|
1408
|
+
if (cmds.length > 1) {
|
|
1409
|
+
cmds = getQuickRunCmds(keyword, '^' + toJsirFileName(pair[1]) + '$')
|
|
1413
1410
|
if (cmds.length === 0) {
|
|
1414
|
-
cmds = getQuickRunCmds(keyword,
|
|
1411
|
+
cmds = getQuickRunCmds(keyword, '^e[^a-zA-Z]' + toJsirFileName(pair[1]) + '$')
|
|
1415
1412
|
}
|
|
1416
1413
|
}
|
|
1417
1414
|
if (cmds.length === 1) {
|
|
@@ -1421,7 +1418,7 @@ const keywordDef = {
|
|
|
1421
1418
|
await runScript(cmds[0], args.slice(1))
|
|
1422
1419
|
}
|
|
1423
1420
|
} else {
|
|
1424
|
-
console.warn(
|
|
1421
|
+
console.warn(`require "${keyword}" not unique`)
|
|
1425
1422
|
}
|
|
1426
1423
|
},
|
|
1427
1424
|
args: {
|
|
@@ -1635,17 +1632,17 @@ async function _dealKeyword(keyword, args) {
|
|
|
1635
1632
|
if (item.short === shortKey) {
|
|
1636
1633
|
unMatched = false;
|
|
1637
1634
|
if (item === keywordDef.run) {
|
|
1638
|
-
console.$log('
|
|
1635
|
+
console.$log('Execute', key)
|
|
1639
1636
|
await item.exeFn(args);
|
|
1640
1637
|
} else {
|
|
1641
|
-
console.$log('
|
|
1638
|
+
console.$log('Execute', key)
|
|
1642
1639
|
await item.exeFn(args.map(trim));
|
|
1643
1640
|
}
|
|
1644
1641
|
break;
|
|
1645
1642
|
}
|
|
1646
1643
|
}
|
|
1647
1644
|
if (unMatched) {
|
|
1648
|
-
console.$log('
|
|
1645
|
+
console.$log('Execute run', keyword)
|
|
1649
1646
|
await keywordDef.run.exeFn([keyword, ...args])
|
|
1650
1647
|
}
|
|
1651
1648
|
}
|
|
@@ -2135,25 +2132,24 @@ function filterRequire(currSpace, cmdMatchStr) {
|
|
|
2135
2132
|
}
|
|
2136
2133
|
cmdMatchStr = trim(cmdMatchStr);
|
|
2137
2134
|
|
|
2138
|
-
let
|
|
2139
|
-
let
|
|
2140
|
-
let
|
|
2141
|
-
if (
|
|
2142
|
-
cmds = [
|
|
2143
|
-
} else {
|
|
2144
|
-
let appointSpace = parseUniqueName(cmdMatchStr)[0]
|
|
2145
|
-
cmds = filterCmd(cmdMatchStr);
|
|
2146
|
-
if (cmds.length > 0) {
|
|
2147
|
-
cmds = cmds.filter(cmd => parseUniqueName(cmd)[0] === (appointSpace || currSpace))
|
|
2148
|
-
}
|
|
2149
|
-
if (cmds.length > 0) {
|
|
2150
|
-
cmds = cmds.filter(cmd => getJsirTypeKey(parseUniqueName(cmd)[1]) === setting.initKey)
|
|
2151
|
-
}
|
|
2135
|
+
let pair = parseUniqueName(cmdMatchStr);
|
|
2136
|
+
let appointSpace = pair[0] || currSpace;
|
|
2137
|
+
let cmds = filterCmd(appointSpace + '/' + pair[1]);
|
|
2138
|
+
if (cmds.length > 1) {
|
|
2139
|
+
cmds = cmds.filter(cmd => [setting.initKey, setting.exeKey].indexOf(getJsirTypeKey(parseUniqueName(cmd)[1])) !== -1)
|
|
2152
2140
|
}
|
|
2153
2141
|
if (cmds.length > 1) {
|
|
2154
|
-
|
|
2155
|
-
}
|
|
2156
|
-
|
|
2142
|
+
cmds = cmds.filter(cmd => setting.initKey === getJsirTypeKey(parseUniqueName(cmd)[1]))
|
|
2143
|
+
}
|
|
2144
|
+
if (cmds.length > 1) {
|
|
2145
|
+
let jsirFileName = toJsirFileName(pair[1])
|
|
2146
|
+
cmds = filterCmd(appointSpace + '/^' + jsirFileName + "$");
|
|
2147
|
+
if (cmds.length === 0) {
|
|
2148
|
+
cmds = filterCmd(appointSpace + '/^[ei][^a-zA-Z]' + jsirFileName + "$");
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
if (cmds.length !== 1) {
|
|
2152
|
+
throw `require "${cmdMatchStr}" not unique`
|
|
2157
2153
|
}
|
|
2158
2154
|
return cmds[0];
|
|
2159
2155
|
}
|
|
@@ -2217,6 +2213,9 @@ function addErrorTag(text) {
|
|
|
2217
2213
|
}
|
|
2218
2214
|
|
|
2219
2215
|
async function evalText($text = '', $cmdName = '', $args = []) {
|
|
2216
|
+
if ($cmdName) {
|
|
2217
|
+
console.$log(`Execute ${$cmdName}`);
|
|
2218
|
+
}
|
|
2220
2219
|
let currSpace;
|
|
2221
2220
|
if ($cmdName) {
|
|
2222
2221
|
let pair = parseUniqueName($cmdName)
|
package/deps/room.js
CHANGED
package/deps/util.js
CHANGED
|
@@ -2089,7 +2089,7 @@ function interceptStdStreams() {
|
|
|
2089
2089
|
if(setting.enterOutputs) {
|
|
2090
2090
|
setting.enterOutputs.push(chunk.toString());
|
|
2091
2091
|
} else if (isRunningInBackground()) {
|
|
2092
|
-
console.$log(
|
|
2092
|
+
console.$log(chunk.toString().trimEnd());
|
|
2093
2093
|
} else {
|
|
2094
2094
|
originalStdoutWrite(chunk, ...args); // 保留原始行为
|
|
2095
2095
|
}
|
|
@@ -2100,7 +2100,7 @@ function interceptStdStreams() {
|
|
|
2100
2100
|
if(setting.enterOutputs) {
|
|
2101
2101
|
setting.enterOutputs.push(chunk.toString());
|
|
2102
2102
|
} else if (isRunningInBackground()) {
|
|
2103
|
-
console.$error(
|
|
2103
|
+
console.$error(chunk.toString().trimEnd());
|
|
2104
2104
|
} else {
|
|
2105
2105
|
originalStderrWrite(chunk, ...args); // 保留原始行为
|
|
2106
2106
|
}
|