@oclif/plugin-commands 2.2.2 → 2.2.4
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 +2 -2
- package/lib/commands/commands.d.ts +13 -1
- package/lib/commands/commands.js +10 -3
- package/lib/utils/tree.d.ts +2 -2
- package/lib/utils/tree.js +1 -1
- package/oclif.manifest.json +116 -1
- package/package.json +7 -7
- package/yarn.lock +578 -925
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @oclif/plugin-commands
|
|
|
20
20
|
$ oclif-example COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ oclif-example (--version)
|
|
23
|
-
@oclif/plugin-commands/2.2.
|
|
23
|
+
@oclif/plugin-commands/2.2.4 linux-x64 node-v18.13.0
|
|
24
24
|
$ oclif-example --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ oclif-example COMMAND
|
|
@@ -61,5 +61,5 @@ DESCRIPTION
|
|
|
61
61
|
list all the commands
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/v2.2.
|
|
64
|
+
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/v2.2.4/src/commands/commands.ts)_
|
|
65
65
|
<!-- commandsstop -->
|
|
@@ -2,7 +2,19 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
export default class Commands extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static enableJsonFlag: boolean;
|
|
5
|
-
static flags:
|
|
5
|
+
static flags: {
|
|
6
|
+
columns: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
sort: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
filter: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
csv: import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
10
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
extended: import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
12
|
+
'no-truncate': import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
13
|
+
'no-header': import("@oclif/core/lib/interfaces").Flag<boolean>;
|
|
14
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
15
|
+
hidden: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
tree: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
};
|
|
6
18
|
run(): Promise<unknown[] | import("@oclif/core/lib/cli-ux/styled/tree").Tree | undefined>;
|
|
7
19
|
private getCommands;
|
|
8
20
|
private removeCycles;
|
package/lib/commands/commands.js
CHANGED
|
@@ -22,7 +22,14 @@ class Commands extends core_1.Command {
|
|
|
22
22
|
});
|
|
23
23
|
if (this.jsonEnabled() && !flags.tree) {
|
|
24
24
|
const formatted = await Promise.all(commands.map(async (cmd) => {
|
|
25
|
-
|
|
25
|
+
// @ts-expect-error
|
|
26
|
+
let commandClass = {};
|
|
27
|
+
try {
|
|
28
|
+
commandClass = await cmd.load();
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
this.debug(error);
|
|
32
|
+
}
|
|
26
33
|
const obj = Object.assign(Object.assign({}, cmd), commandClass);
|
|
27
34
|
// Load all properties on all extending classes.
|
|
28
35
|
while (commandClass !== undefined) {
|
|
@@ -43,7 +50,7 @@ class Commands extends core_1.Command {
|
|
|
43
50
|
}
|
|
44
51
|
return tree;
|
|
45
52
|
}
|
|
46
|
-
core_1.
|
|
53
|
+
core_1.ux.table(commands.map(command => {
|
|
47
54
|
// Massage some fields so it looks good in the table
|
|
48
55
|
command.description = (command.description || '').split(os_1.EOL)[0];
|
|
49
56
|
command.summary = (command.summary || (command.description || '').split(os_1.EOL)[0]);
|
|
@@ -113,4 +120,4 @@ class Commands extends core_1.Command {
|
|
|
113
120
|
exports.default = Commands;
|
|
114
121
|
Commands.description = 'list all the commands';
|
|
115
122
|
Commands.enableJsonFlag = true;
|
|
116
|
-
Commands.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), hidden: core_1.Flags.boolean({ description: 'show hidden commands' }), tree: core_1.Flags.boolean({ description: 'show tree of commands' }) }, core_1.
|
|
123
|
+
Commands.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), hidden: core_1.Flags.boolean({ description: 'show hidden commands' }), tree: core_1.Flags.boolean({ description: 'show tree of commands' }) }, core_1.ux.table.flags());
|
package/lib/utils/tree.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
2
|
import { Tree } from '@oclif/core/lib/cli-ux/styled/tree';
|
|
3
|
-
declare const createCommandTree: (commands:
|
|
3
|
+
declare const createCommandTree: (commands: Command.Loadable[], topicSeparator?: string) => Tree;
|
|
4
4
|
export default createCommandTree;
|
package/lib/utils/tree.js
CHANGED
|
@@ -17,7 +17,7 @@ const addNodes = (tree, commandParts) => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
const createCommandTree = (commands, topicSeparator = ':') => {
|
|
20
|
-
const tree = core_1.
|
|
20
|
+
const tree = core_1.ux.tree();
|
|
21
21
|
commands.forEach(command => {
|
|
22
22
|
const commandParts = command.id.split(topicSeparator);
|
|
23
23
|
addNodes(tree, commandParts);
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1,116 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": "2.2.4",
|
|
3
|
+
"commands": {
|
|
4
|
+
"commands": {
|
|
5
|
+
"id": "commands",
|
|
6
|
+
"description": "list all the commands",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"pluginName": "@oclif/plugin-commands",
|
|
9
|
+
"pluginAlias": "@oclif/plugin-commands",
|
|
10
|
+
"pluginType": "core",
|
|
11
|
+
"aliases": [],
|
|
12
|
+
"flags": {
|
|
13
|
+
"json": {
|
|
14
|
+
"name": "json",
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"description": "Format output as json.",
|
|
17
|
+
"helpGroup": "GLOBAL",
|
|
18
|
+
"allowNo": false
|
|
19
|
+
},
|
|
20
|
+
"help": {
|
|
21
|
+
"name": "help",
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"char": "h",
|
|
24
|
+
"description": "Show CLI help.",
|
|
25
|
+
"allowNo": false
|
|
26
|
+
},
|
|
27
|
+
"hidden": {
|
|
28
|
+
"name": "hidden",
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "show hidden commands",
|
|
31
|
+
"allowNo": false
|
|
32
|
+
},
|
|
33
|
+
"tree": {
|
|
34
|
+
"name": "tree",
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"description": "show tree of commands",
|
|
37
|
+
"allowNo": false
|
|
38
|
+
},
|
|
39
|
+
"columns": {
|
|
40
|
+
"name": "columns",
|
|
41
|
+
"type": "option",
|
|
42
|
+
"description": "only show provided columns (comma-separated)",
|
|
43
|
+
"multiple": false,
|
|
44
|
+
"exclusive": [
|
|
45
|
+
"extended"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"sort": {
|
|
49
|
+
"name": "sort",
|
|
50
|
+
"type": "option",
|
|
51
|
+
"description": "property to sort by (prepend '-' for descending)",
|
|
52
|
+
"multiple": false
|
|
53
|
+
},
|
|
54
|
+
"filter": {
|
|
55
|
+
"name": "filter",
|
|
56
|
+
"type": "option",
|
|
57
|
+
"description": "filter property by partial string matching, ex: name=foo",
|
|
58
|
+
"multiple": false
|
|
59
|
+
},
|
|
60
|
+
"csv": {
|
|
61
|
+
"name": "csv",
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"description": "output is csv format [alias: --output=csv]",
|
|
64
|
+
"allowNo": false,
|
|
65
|
+
"exclusive": [
|
|
66
|
+
"no-truncate"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"output": {
|
|
70
|
+
"name": "output",
|
|
71
|
+
"type": "option",
|
|
72
|
+
"description": "output in a more machine friendly format",
|
|
73
|
+
"multiple": false,
|
|
74
|
+
"options": [
|
|
75
|
+
"csv",
|
|
76
|
+
"json",
|
|
77
|
+
"yaml"
|
|
78
|
+
],
|
|
79
|
+
"exclusive": [
|
|
80
|
+
"no-truncate",
|
|
81
|
+
"csv"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"extended": {
|
|
85
|
+
"name": "extended",
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"char": "x",
|
|
88
|
+
"description": "show extra columns",
|
|
89
|
+
"allowNo": false,
|
|
90
|
+
"exclusive": [
|
|
91
|
+
"columns"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"no-truncate": {
|
|
95
|
+
"name": "no-truncate",
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"description": "do not truncate output to fit screen",
|
|
98
|
+
"allowNo": false,
|
|
99
|
+
"exclusive": [
|
|
100
|
+
"csv"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"no-header": {
|
|
104
|
+
"name": "no-header",
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"description": "hide table header from output",
|
|
107
|
+
"allowNo": false,
|
|
108
|
+
"exclusive": [
|
|
109
|
+
"csv"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"args": {}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/plugin-commands",
|
|
3
3
|
"description": "plugin to show the list of all the commands",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.4",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/plugin-commands/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@oclif/core": "^
|
|
8
|
+
"@oclif/core": "^2.0.3",
|
|
9
9
|
"lodash": "^4.17.11"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@oclif/plugin-help": "^5.
|
|
13
|
-
"@oclif/test": "^2.
|
|
12
|
+
"@oclif/plugin-help": "^5.2.0",
|
|
13
|
+
"@oclif/test": "^2.3.3",
|
|
14
14
|
"@types/chai": "^4.3.4",
|
|
15
15
|
"@types/lodash": "^4.14.191",
|
|
16
16
|
"@types/mocha": "^8.0.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"eslint-config-oclif-typescript": "^0.2.0",
|
|
23
23
|
"globby": "^11",
|
|
24
24
|
"mocha": "^8",
|
|
25
|
-
"nock": "^13.
|
|
25
|
+
"nock": "^13.3.0",
|
|
26
26
|
"nyc": "^15.1.0",
|
|
27
|
-
"oclif": "^
|
|
27
|
+
"oclif": "^3.6.1",
|
|
28
28
|
"shx": "^0.3.3",
|
|
29
29
|
"ts-node": "^9.1.1",
|
|
30
30
|
"tslib": "^2.4.1",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
56
56
|
"pretest": "yarn build && tsc -p test --noEmit",
|
|
57
|
-
"test": "mocha
|
|
57
|
+
"test": "mocha \"test/**/*.test.ts\"",
|
|
58
58
|
"posttest": "yarn lint",
|
|
59
59
|
"prepack": "shx rm -rf lib && tsc && oclif manifest . && oclif readme",
|
|
60
60
|
"postpack": "shx rm -f oclif.manifest.json",
|