@oclif/plugin-commands 1.3.0 → 2.1.0
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 +23 -0
- package/README.md +27 -21
- package/lib/commands/commands.d.ts +4 -3
- package/lib/commands/commands.js +43 -38
- package/oclif.manifest.json +1 -1
- package/package.json +27 -25
- package/yarn.lock +4169 -1976
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
## [2.1.0](https://github.com/oclif/plugin-commands/compare/v2.0.2...v2.1.0) (2022-01-28)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* remove cli-ux ([#257](https://github.com/oclif/plugin-commands/issues/257)) ([91d8696](https://github.com/oclif/plugin-commands/commit/91d8696bff375e622092744ab005daabf12c34d2))
|
|
11
|
+
|
|
12
|
+
### [2.0.2](https://github.com/oclif/plugin-commands/compare/v2.0.0...v2.0.2) (2022-01-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* add summary and use configured command ([#217](https://github.com/oclif/plugin-commands/issues/217)) ([d1ce99e](https://github.com/oclif/plugin-commands/commit/d1ce99eb233155e019a585177972188953b0ffaf))
|
|
18
|
+
* build error ([6cc7807](https://github.com/oclif/plugin-commands/commit/6cc780725e5dbb64fbc105206cc580bf45325749))
|
|
19
|
+
* bump deps ([#234](https://github.com/oclif/plugin-commands/issues/234)) ([04c903d](https://github.com/oclif/plugin-commands/commit/04c903d45a51987f6262628c7a401481dc237145))
|
|
20
|
+
* bump deps and fix tests ([#236](https://github.com/oclif/plugin-commands/issues/236)) ([064da3f](https://github.com/oclif/plugin-commands/commit/064da3f22778c9625c640012b883eee8c1528ab1))
|
|
21
|
+
* bump-deps ([#235](https://github.com/oclif/plugin-commands/issues/235)) ([55b3e59](https://github.com/oclif/plugin-commands/commit/55b3e59e0743078d2bf81bfa75a56ebd0b746c4b))
|
|
22
|
+
* use enableJsonFlag to enable json output ([#253](https://github.com/oclif/plugin-commands/issues/253)) ([5c839bc](https://github.com/oclif/plugin-commands/commit/5c839bc3d5b079c3080858ca4bc704283ff9d345))
|
|
23
|
+
|
|
1
24
|
## [1.2.2](https://github.com/oclif/plugin-commands/compare/v1.2.1...v1.2.2) (2018-10-13)
|
|
2
25
|
|
|
3
26
|
|
package/README.md
CHANGED
|
@@ -4,11 +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://codecov.io/gh/oclif/plugin-commands)
|
|
7
|
+
[](https://circleci.com/gh/oclif/plugin-commands/tree/main)
|
|
8
|
+
[](https://ci.appveyor.com/project/oclif/plugin-commands/branch/main)
|
|
10
9
|
[](https://npmjs.org/package/@oclif/plugin-commands)
|
|
11
|
-
[](https://github.com/oclif/plugin-commands/blob/
|
|
10
|
+
[](https://github.com/oclif/plugin-commands/blob/main/package.json)
|
|
12
11
|
|
|
13
12
|
<!-- toc -->
|
|
14
13
|
* [Usage](#usage)
|
|
@@ -20,8 +19,8 @@ plugin to show the list of all the commands
|
|
|
20
19
|
$ npm install -g @oclif/plugin-commands
|
|
21
20
|
$ oclif-example COMMAND
|
|
22
21
|
running command...
|
|
23
|
-
$ oclif-example (
|
|
24
|
-
@oclif/plugin-commands/1.
|
|
22
|
+
$ oclif-example (--version)
|
|
23
|
+
@oclif/plugin-commands/2.1.0 linux-x64 node-v12.22.9
|
|
25
24
|
$ oclif-example --help [COMMAND]
|
|
26
25
|
USAGE
|
|
27
26
|
$ oclif-example COMMAND
|
|
@@ -38,21 +37,28 @@ list all the commands
|
|
|
38
37
|
|
|
39
38
|
```
|
|
40
39
|
USAGE
|
|
41
|
-
$ oclif-example commands
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
-x, --extended
|
|
47
|
-
--columns
|
|
48
|
-
--csv
|
|
49
|
-
--filter
|
|
50
|
-
--hidden
|
|
51
|
-
--no-header
|
|
52
|
-
--no-truncate
|
|
53
|
-
--output
|
|
54
|
-
|
|
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
|
+
|
|
43
|
+
FLAGS
|
|
44
|
+
-h, --help Show CLI help.
|
|
45
|
+
-x, --extended show extra columns
|
|
46
|
+
--columns=<value> only show provided columns (comma-separated)
|
|
47
|
+
--csv output is csv format [alias: --output=csv]
|
|
48
|
+
--filter=<value> filter property by partial string matching, ex: name=foo
|
|
49
|
+
--hidden show hidden commands
|
|
50
|
+
--no-header hide table header from output
|
|
51
|
+
--no-truncate do not truncate output to fit screen
|
|
52
|
+
--output=<option> output in a more machine friendly format
|
|
53
|
+
<options: csv|json|yaml>
|
|
54
|
+
--sort=<value> property to sort by (prepend '-' for descending)
|
|
55
|
+
|
|
56
|
+
GLOBAL FLAGS
|
|
57
|
+
--json Format output as json.
|
|
58
|
+
|
|
59
|
+
DESCRIPTION
|
|
60
|
+
list all the commands
|
|
55
61
|
```
|
|
56
62
|
|
|
57
|
-
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/
|
|
63
|
+
_See code: [src/commands/commands.ts](https://github.com/oclif/plugin-commands/blob/v2.1.0/src/commands/commands.ts)_
|
|
58
64
|
<!-- commandsstop -->
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
2
|
export default class Commands extends Command {
|
|
3
3
|
static description: string;
|
|
4
|
-
static
|
|
5
|
-
|
|
4
|
+
static enableJsonFlag: boolean;
|
|
5
|
+
static flags: any;
|
|
6
|
+
run(): Promise<unknown[] | undefined>;
|
|
6
7
|
private getCommands;
|
|
7
8
|
private removeCycles;
|
|
8
9
|
}
|
package/lib/commands/commands.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const cli_ux_1 = require("cli-ux");
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
5
4
|
const _ = require("lodash");
|
|
6
5
|
const os_1 = require("os");
|
|
7
|
-
class Commands extends
|
|
6
|
+
class Commands extends core_1.Command {
|
|
8
7
|
async run() {
|
|
9
|
-
const { flags } = this.parse(Commands);
|
|
8
|
+
const { flags } = await this.parse(Commands);
|
|
10
9
|
let commands = this.getCommands();
|
|
11
10
|
if (!flags.hidden) {
|
|
12
11
|
commands = commands.filter(c => !c.hidden);
|
|
@@ -15,13 +14,15 @@ class Commands extends command_1.Command {
|
|
|
15
14
|
commands = _.sortBy(commands, 'id').map(command => {
|
|
16
15
|
// Template supported fields.
|
|
17
16
|
command.description = (typeof command.description === 'string' && _.template(command.description)({ command, config })) || undefined;
|
|
17
|
+
command.summary = (typeof command.summary === 'string' && _.template(command.summary)({ command, config })) || undefined;
|
|
18
18
|
command.usage = (typeof command.usage === 'string' && _.template(command.usage)({ command, config })) || undefined;
|
|
19
|
+
command.id = (0, core_1.toConfiguredId)(command.id, this.config);
|
|
19
20
|
return command;
|
|
20
21
|
});
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
let commandClass = cmd.load();
|
|
24
|
-
const obj = Object.assign({}, cmd, commandClass);
|
|
22
|
+
if (this.jsonEnabled()) {
|
|
23
|
+
const formatted = await Promise.all(commands.map(async (cmd) => {
|
|
24
|
+
let commandClass = await cmd.load();
|
|
25
|
+
const obj = Object.assign(Object.assign({}, cmd), commandClass);
|
|
25
26
|
// Load all properties on all extending classes.
|
|
26
27
|
while (commandClass !== undefined) {
|
|
27
28
|
commandClass = Object.getPrototypeOf(commandClass) || undefined;
|
|
@@ -32,35 +33,38 @@ class Commands extends command_1.Command {
|
|
|
32
33
|
// If Command classes have circular references, don't break the commands command.
|
|
33
34
|
return this.removeCycles(obj);
|
|
34
35
|
}));
|
|
36
|
+
return formatted;
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
core_1.CliUx.ux.table(commands.map(command => {
|
|
39
|
+
// Massage some fields so it looks good in the table
|
|
40
|
+
command.description = (command.description || '').split(os_1.EOL)[0];
|
|
41
|
+
command.summary = (command.summary || (command.description || '').split(os_1.EOL)[0]);
|
|
42
|
+
command.hidden = Boolean(command.hidden);
|
|
43
|
+
command.usage = (command.usage || '');
|
|
44
|
+
return command;
|
|
45
|
+
}), {
|
|
46
|
+
id: {
|
|
47
|
+
header: 'Command',
|
|
48
|
+
},
|
|
49
|
+
summary: {},
|
|
50
|
+
description: {
|
|
51
|
+
extended: true,
|
|
52
|
+
},
|
|
53
|
+
usage: {
|
|
54
|
+
extended: true,
|
|
55
|
+
},
|
|
56
|
+
pluginName: {
|
|
57
|
+
extended: true,
|
|
58
|
+
header: 'Plugin',
|
|
59
|
+
},
|
|
60
|
+
pluginType: {
|
|
61
|
+
extended: true,
|
|
62
|
+
header: 'Type',
|
|
63
|
+
},
|
|
64
|
+
hidden: {
|
|
65
|
+
extended: true,
|
|
66
|
+
},
|
|
67
|
+
}, Object.assign({}, flags));
|
|
64
68
|
}
|
|
65
69
|
getCommands() {
|
|
66
70
|
return this.config.commands;
|
|
@@ -98,6 +102,7 @@ class Commands extends command_1.Command {
|
|
|
98
102
|
return _removeCycles(object);
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
|
-
Commands.description = 'list all the commands';
|
|
102
|
-
Commands.flags = Object.assign({ help: command_1.flags.help({ char: 'h' }), json: command_1.flags.boolean({ char: 'j', description: 'display unfiltered api data in json format' }), hidden: command_1.flags.boolean({ description: 'show hidden commands' }) }, cli_ux_1.ux.table.flags());
|
|
103
105
|
exports.default = Commands;
|
|
106
|
+
Commands.description = 'list all the commands';
|
|
107
|
+
Commands.enableJsonFlag = true;
|
|
108
|
+
Commands.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), hidden: core_1.Flags.boolean({ description: 'show hidden commands' }) }, core_1.CliUx.ux.table.flags());
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.
|
|
1
|
+
{"version":"2.1.0","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,36 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/plugin-commands",
|
|
3
3
|
"description": "plugin to show the list of all the commands",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"author": "
|
|
4
|
+
"version": "2.1.0",
|
|
5
|
+
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/plugin-commands/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@oclif/
|
|
9
|
-
"@oclif/config": "^1.8.7",
|
|
10
|
-
"cli-ux": "^5.4.5",
|
|
8
|
+
"@oclif/core": "^1.2.0",
|
|
11
9
|
"lodash": "^4.17.11"
|
|
12
10
|
},
|
|
13
11
|
"devDependencies": {
|
|
14
|
-
"@oclif/
|
|
15
|
-
"@oclif/
|
|
16
|
-
"@oclif/test": "^1.2.1",
|
|
12
|
+
"@oclif/plugin-help": "^5.1.7",
|
|
13
|
+
"@oclif/test": "^2.0.2",
|
|
17
14
|
"@types/chai": "^4.1.6",
|
|
18
15
|
"@types/lodash": "^4.14.117",
|
|
19
|
-
"@types/mocha": "^
|
|
20
|
-
"@types/
|
|
16
|
+
"@types/mocha": "^8.0.0",
|
|
17
|
+
"@types/nock": "^11.1.0",
|
|
18
|
+
"@types/node": "^14.0.14",
|
|
21
19
|
"chai": "^4.2.0",
|
|
22
|
-
"eslint": "^
|
|
20
|
+
"eslint": "^7.3.1",
|
|
23
21
|
"eslint-config-oclif": "^3.1.0",
|
|
24
|
-
"eslint-config-oclif-typescript": "^0.
|
|
25
|
-
"globby": "^
|
|
26
|
-
"mocha": "^
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
22
|
+
"eslint-config-oclif-typescript": "^0.2.0",
|
|
23
|
+
"globby": "^11",
|
|
24
|
+
"mocha": "^8",
|
|
25
|
+
"nock": "^13.0.0",
|
|
26
|
+
"nyc": "^15.1.0",
|
|
27
|
+
"oclif": "^2.3.0",
|
|
28
|
+
"shx": "^0.3.3",
|
|
29
|
+
"ts-node": "^9.1.1",
|
|
30
|
+
"tslib": "^2.0.0",
|
|
31
|
+
"typescript": "4.4.3"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
34
|
+
"node": ">=12.0.0"
|
|
34
35
|
},
|
|
35
36
|
"files": [
|
|
36
37
|
"/lib",
|
|
@@ -51,12 +52,13 @@
|
|
|
51
52
|
},
|
|
52
53
|
"repository": "oclif/plugin-commands",
|
|
53
54
|
"scripts": {
|
|
54
|
-
"lint": "eslint
|
|
55
|
-
"pretest": "tsc -p test --noEmit",
|
|
56
|
-
"test": "
|
|
55
|
+
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
56
|
+
"pretest": "yarn build && tsc -p test --noEmit",
|
|
57
|
+
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
57
58
|
"posttest": "yarn lint",
|
|
58
|
-
"prepack": "rm -rf lib && tsc && oclif
|
|
59
|
-
"postpack": "rm -f oclif.manifest.json",
|
|
60
|
-
"version": "oclif
|
|
59
|
+
"prepack": "shx rm -rf lib && tsc && oclif manifest . && oclif readme",
|
|
60
|
+
"postpack": "shx rm -f oclif.manifest.json",
|
|
61
|
+
"version": "oclif readme && git add README.md",
|
|
62
|
+
"build": "shx rm -rf lib && tsc"
|
|
61
63
|
}
|
|
62
64
|
}
|