@oclif/core 1.8.0 → 1.8.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/CHANGELOG.md +7 -0
- package/lib/help/util.js +6 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.8.1](https://github.com/oclif/core/compare/v1.8.0...v1.8.1) (2022-05-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* improve algo for collating command id ([#415](https://github.com/oclif/core/issues/415)) ([1a9bfdb](https://github.com/oclif/core/commit/1a9bfdb810e13506ed8fc4138cde1912981b97e3))
|
|
11
|
+
|
|
5
12
|
## [1.8.0](https://github.com/oclif/core/compare/v1.7.0...v1.8.0) (2022-05-06)
|
|
6
13
|
|
|
7
14
|
|
package/lib/help/util.js
CHANGED
|
@@ -33,28 +33,27 @@ exports.template = template;
|
|
|
33
33
|
function collateSpacedCmdIDFromArgs(argv, config) {
|
|
34
34
|
if (argv.length === 1)
|
|
35
35
|
return argv;
|
|
36
|
-
const ids = (0, util_1.collectUsableIds)(config.commandIDs);
|
|
37
36
|
const findId = (argv) => {
|
|
37
|
+
const ids = (0, util_1.collectUsableIds)(config.commandIDs);
|
|
38
38
|
const final = [];
|
|
39
39
|
const idPresent = (id) => ids.includes(id);
|
|
40
40
|
const isFlag = (s) => s.startsWith('-');
|
|
41
41
|
const isArgWithValue = (s) => s.includes('=');
|
|
42
42
|
const finalizeId = (s) => s ? [...final, s].join(':') : final.join(':');
|
|
43
|
-
const
|
|
43
|
+
const hasArgs = () => {
|
|
44
|
+
var _a;
|
|
44
45
|
const id = finalizeId();
|
|
45
46
|
if (!id)
|
|
46
47
|
return false;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const subCommands = config.commands.filter(c => (c.id).startsWith(id));
|
|
50
|
-
return Boolean(subCommands.find(cmd => { var _a; return cmd.strict === false || ((_a = cmd.args) === null || _a === void 0 ? void 0 : _a.length) > 0; }));
|
|
48
|
+
const cmd = config.findCommand(id);
|
|
49
|
+
return Boolean(cmd && (cmd.strict === false || ((_a = cmd.args) === null || _a === void 0 ? void 0 : _a.length) > 0));
|
|
51
50
|
};
|
|
52
51
|
for (const arg of argv) {
|
|
53
52
|
if (idPresent(finalizeId(arg)))
|
|
54
53
|
final.push(arg);
|
|
55
54
|
// If the parent topic has a command that expects positional arguments, then we cannot
|
|
56
55
|
// assume that any subsequent string could be part of the command name
|
|
57
|
-
else if (isArgWithValue(arg) || isFlag(arg) ||
|
|
56
|
+
else if (isArgWithValue(arg) || isFlag(arg) || hasArgs())
|
|
58
57
|
break;
|
|
59
58
|
else
|
|
60
59
|
final.push(arg);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/core",
|
|
3
3
|
"description": "base library for oclif CLIs",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.1",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"natural-orderby": "^2.0.3",
|
|
27
27
|
"object-treeify": "^1.1.33",
|
|
28
28
|
"password-prompt": "^1.1.2",
|
|
29
|
-
"semver": "^7.3.
|
|
29
|
+
"semver": "^7.3.7",
|
|
30
30
|
"string-width": "^4.2.3",
|
|
31
31
|
"strip-ansi": "^6.0.1",
|
|
32
32
|
"supports-color": "^8.1.1",
|