@oclif/plugin-commands 2.0.1 → 2.0.2
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 +2 -1
- package/README.md +10 -8
- package/lib/commands/commands.d.ts +2 -1
- package/lib/commands/commands.js +36 -36
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
-
### [2.0.
|
|
5
|
+
### [2.0.2](https://github.com/oclif/plugin-commands/compare/v2.0.0...v2.0.2) (2022-01-03)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
### Bug Fixes
|
|
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
12
12
|
* bump deps ([#234](https://github.com/oclif/plugin-commands/issues/234)) ([04c903d](https://github.com/oclif/plugin-commands/commit/04c903d45a51987f6262628c7a401481dc237145))
|
|
13
13
|
* bump deps and fix tests ([#236](https://github.com/oclif/plugin-commands/issues/236)) ([064da3f](https://github.com/oclif/plugin-commands/commit/064da3f22778c9625c640012b883eee8c1528ab1))
|
|
14
14
|
* bump-deps ([#235](https://github.com/oclif/plugin-commands/issues/235)) ([55b3e59](https://github.com/oclif/plugin-commands/commit/55b3e59e0743078d2bf81bfa75a56ebd0b746c4b))
|
|
15
|
+
* use enableJsonFlag to enable json output ([#253](https://github.com/oclif/plugin-commands/issues/253)) ([5c839bc](https://github.com/oclif/plugin-commands/commit/5c839bc3d5b079c3080858ca4bc704283ff9d345))
|
|
15
16
|
|
|
16
17
|
## [1.2.2](https://github.com/oclif/plugin-commands/compare/v1.2.1...v1.2.2) (2018-10-13)
|
|
17
18
|
|
package/README.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
plugin to show the list of all the commands
|
|
5
5
|
|
|
6
6
|
[](https://npmjs.org/package/@oclif/plugin-commands)
|
|
7
|
-
[](https://circleci.com/gh/oclif/plugin-commands/tree/main)
|
|
8
|
+
[](https://ci.appveyor.com/project/oclif/plugin-commands/branch/main)
|
|
9
9
|
[](https://npmjs.org/package/@oclif/plugin-commands)
|
|
10
|
-
[](https://github.com/oclif/plugin-commands/blob/
|
|
10
|
+
[](https://github.com/oclif/plugin-commands/blob/main/package.json)
|
|
11
11
|
|
|
12
12
|
<!-- toc -->
|
|
13
13
|
* [Usage](#usage)
|
|
@@ -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.0.
|
|
23
|
+
@oclif/plugin-commands/2.0.2 linux-x64 node-v12.22.8
|
|
24
24
|
$ oclif-example --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ oclif-example COMMAND
|
|
@@ -37,12 +37,11 @@ list all the commands
|
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
USAGE
|
|
40
|
-
$ oclif-example commands [
|
|
41
|
-
[--output csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ]
|
|
40
|
+
$ oclif-example commands [--json] [-h] [--hidden] [--columns <value> | -x] [--sort <value>] [--filter
|
|
41
|
+
<value>] [--output csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ]
|
|
42
42
|
|
|
43
43
|
FLAGS
|
|
44
44
|
-h, --help Show CLI help.
|
|
45
|
-
-j, --json display unfiltered api data in json format
|
|
46
45
|
-x, --extended show extra columns
|
|
47
46
|
--columns=<value> only show provided columns (comma-separated)
|
|
48
47
|
--csv output is csv format [alias: --output=csv]
|
|
@@ -54,9 +53,12 @@ FLAGS
|
|
|
54
53
|
<options: csv|json|yaml>
|
|
55
54
|
--sort=<value> property to sort by (prepend '-' for descending)
|
|
56
55
|
|
|
56
|
+
GLOBAL FLAGS
|
|
57
|
+
--json Format output as json.
|
|
58
|
+
|
|
57
59
|
DESCRIPTION
|
|
58
60
|
list all the commands
|
|
59
61
|
```
|
|
60
62
|
|
|
61
|
-
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/v2.0.
|
|
63
|
+
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/v2.0.2/src/commands/commands.ts)_
|
|
62
64
|
<!-- commandsstop -->
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
export default class Commands extends Command {
|
|
3
3
|
static description: string;
|
|
4
|
+
static enableJsonFlag: boolean;
|
|
4
5
|
static flags: any;
|
|
5
|
-
run(): Promise<
|
|
6
|
+
run(): Promise<unknown[] | undefined>;
|
|
6
7
|
private getCommands;
|
|
7
8
|
private removeCycles;
|
|
8
9
|
}
|
package/lib/commands/commands.js
CHANGED
|
@@ -20,8 +20,8 @@ class Commands extends core_1.Command {
|
|
|
20
20
|
command.id = (0, core_1.toConfiguredId)(command.id, this.config);
|
|
21
21
|
return command;
|
|
22
22
|
});
|
|
23
|
-
if (
|
|
24
|
-
|
|
23
|
+
if (this.jsonEnabled()) {
|
|
24
|
+
const formatted = await Promise.all(commands.map(async (cmd) => {
|
|
25
25
|
let commandClass = await cmd.load();
|
|
26
26
|
const obj = Object.assign(Object.assign({}, cmd), commandClass);
|
|
27
27
|
// Load all properties on all extending classes.
|
|
@@ -33,40 +33,39 @@ class Commands extends core_1.Command {
|
|
|
33
33
|
delete obj.plugin;
|
|
34
34
|
// If Command classes have circular references, don't break the commands command.
|
|
35
35
|
return this.removeCycles(obj);
|
|
36
|
-
}))
|
|
37
|
-
|
|
38
|
-
else {
|
|
39
|
-
cli_ux_1.ux.table(commands.map(command => {
|
|
40
|
-
// Massage some fields so it looks good in the table
|
|
41
|
-
command.description = (command.description || '').split(os_1.EOL)[0];
|
|
42
|
-
command.summary = (command.summary || (command.description || '').split(os_1.EOL)[0]);
|
|
43
|
-
command.hidden = Boolean(command.hidden);
|
|
44
|
-
command.usage = (command.usage || '');
|
|
45
|
-
return command;
|
|
46
|
-
}), {
|
|
47
|
-
id: {
|
|
48
|
-
header: 'Command',
|
|
49
|
-
},
|
|
50
|
-
summary: {},
|
|
51
|
-
description: {
|
|
52
|
-
extended: true,
|
|
53
|
-
},
|
|
54
|
-
usage: {
|
|
55
|
-
extended: true,
|
|
56
|
-
},
|
|
57
|
-
pluginName: {
|
|
58
|
-
extended: true,
|
|
59
|
-
header: 'Plugin',
|
|
60
|
-
},
|
|
61
|
-
pluginType: {
|
|
62
|
-
extended: true,
|
|
63
|
-
header: 'Type',
|
|
64
|
-
},
|
|
65
|
-
hidden: {
|
|
66
|
-
extended: true,
|
|
67
|
-
},
|
|
68
|
-
}, Object.assign({}, flags));
|
|
36
|
+
}));
|
|
37
|
+
return formatted;
|
|
69
38
|
}
|
|
39
|
+
cli_ux_1.ux.table(commands.map(command => {
|
|
40
|
+
// Massage some fields so it looks good in the table
|
|
41
|
+
command.description = (command.description || '').split(os_1.EOL)[0];
|
|
42
|
+
command.summary = (command.summary || (command.description || '').split(os_1.EOL)[0]);
|
|
43
|
+
command.hidden = Boolean(command.hidden);
|
|
44
|
+
command.usage = (command.usage || '');
|
|
45
|
+
return command;
|
|
46
|
+
}), {
|
|
47
|
+
id: {
|
|
48
|
+
header: 'Command',
|
|
49
|
+
},
|
|
50
|
+
summary: {},
|
|
51
|
+
description: {
|
|
52
|
+
extended: true,
|
|
53
|
+
},
|
|
54
|
+
usage: {
|
|
55
|
+
extended: true,
|
|
56
|
+
},
|
|
57
|
+
pluginName: {
|
|
58
|
+
extended: true,
|
|
59
|
+
header: 'Plugin',
|
|
60
|
+
},
|
|
61
|
+
pluginType: {
|
|
62
|
+
extended: true,
|
|
63
|
+
header: 'Type',
|
|
64
|
+
},
|
|
65
|
+
hidden: {
|
|
66
|
+
extended: true,
|
|
67
|
+
},
|
|
68
|
+
}, Object.assign({}, flags));
|
|
70
69
|
}
|
|
71
70
|
getCommands() {
|
|
72
71
|
return this.config.commands;
|
|
@@ -106,5 +105,6 @@ class Commands extends core_1.Command {
|
|
|
106
105
|
}
|
|
107
106
|
exports.default = Commands;
|
|
108
107
|
Commands.description = 'list all the commands';
|
|
108
|
+
Commands.enableJsonFlag = true;
|
|
109
109
|
// to-do: update this type when cli-ux is on core
|
|
110
|
-
Commands.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }),
|
|
110
|
+
Commands.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), hidden: core_1.Flags.boolean({ description: 'show hidden commands' }) }, cli_ux_1.ux.table.flags());
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.0.
|
|
1
|
+
{"version":"2.0.2","commands":{"commands":{"id":"commands","description":"list all the commands","strict":true,"pluginName":"@oclif/plugin-commands","pluginAlias":"@oclif/plugin-commands","pluginType":"core","aliases":[],"flags":{"json":{"name":"json","type":"boolean","description":"Format output as json.","helpGroup":"GLOBAL","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"Show CLI help.","allowNo":false},"hidden":{"name":"hidden","type":"boolean","description":"show hidden commands","allowNo":false},"columns":{"name":"columns","type":"option","description":"only show provided columns (comma-separated)","multiple":false,"exclusive":["extended"]},"sort":{"name":"sort","type":"option","description":"property to sort by (prepend '-' for descending)","multiple":false},"filter":{"name":"filter","type":"option","description":"filter property by partial string matching, ex: name=foo","multiple":false},"csv":{"name":"csv","type":"boolean","description":"output is csv format [alias: --output=csv]","allowNo":false,"exclusive":["no-truncate"]},"output":{"name":"output","type":"option","description":"output in a more machine friendly format","multiple":false,"options":["csv","json","yaml"],"exclusive":["no-truncate","csv"]},"extended":{"name":"extended","type":"boolean","char":"x","description":"show extra columns","allowNo":false,"exclusive":["columns"]},"no-truncate":{"name":"no-truncate","type":"boolean","description":"do not truncate output to fit screen","allowNo":false,"exclusive":["csv"]},"no-header":{"name":"no-header","type":"boolean","description":"hide table header from output","allowNo":false,"exclusive":["csv"]}},"args":[],"enableJsonFlag":true}}}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/plugin-commands",
|
|
3
3
|
"description": "plugin to show the list of all the commands",
|
|
4
|
-
"version": "2.0.
|
|
5
|
-
"author": "
|
|
4
|
+
"version": "2.0.2",
|
|
5
|
+
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/plugin-commands/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@oclif/core": "^1.0.8",
|