@oclif/plugin-help 3.0.0-rc1.2 → 3.2.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [3.2.0](https://github.com/oclif/plugin-help/compare/v3.1.0...v3.2.0) (2020-08-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * support src/command/index cmd ([#112](https://github.com/oclif/plugin-help/issues/112)) ([8957336](https://github.com/oclif/plugin-help/commit/8957336f3c35675bb243ac90c49c298fbef23e59))
7
+
1
8
  ## [2.1.4](https://github.com/oclif/plugin-help/compare/v2.1.3...v2.1.4) (2018-11-12)
2
9
 
3
10
 
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Config from '@oclif/config';
2
- export { getHelpClass } from './util';
2
+ import { getHelpClass } from './util';
3
3
  export interface HelpOptions {
4
4
  all?: boolean;
5
5
  maxWidth: number;
@@ -43,3 +43,4 @@ export default class Help extends HelpBase {
43
43
  */
44
44
  protected command(command: Config.Command): string;
45
45
  }
46
+ export { Help, getHelpClass, };
package/lib/index.js CHANGED
@@ -9,18 +9,19 @@ const list_1 = require("./list");
9
9
  const root_1 = require("./root");
10
10
  const screen_1 = require("./screen");
11
11
  const util_1 = require("./util");
12
- var util_2 = require("./util");
12
+ const util_2 = require("./util");
13
13
  exports.getHelpClass = util_2.getHelpClass;
14
14
  const wrap = require('wrap-ansi');
15
15
  const { bold, } = chalk_1.default;
16
+ const ROOT_INDEX_CMD_ID = '';
16
17
  function getHelpSubject(args) {
17
18
  for (const arg of args) {
18
19
  if (arg === '--')
19
20
  return;
20
- if (arg.startsWith('-'))
21
- continue;
22
- if (arg === 'help')
21
+ if (arg === 'help' || arg === '--help' || arg === '-h')
23
22
  continue;
23
+ if (arg.startsWith('-'))
24
+ return;
24
25
  return arg;
25
26
  }
26
27
  }
@@ -66,6 +67,9 @@ class Help extends HelpBase {
66
67
  showHelp(argv) {
67
68
  const subject = getHelpSubject(argv);
68
69
  if (!subject) {
70
+ const rootCmd = this.config.findCommand(ROOT_INDEX_CMD_ID);
71
+ if (rootCmd)
72
+ this.showCommandHelp(rootCmd);
69
73
  this.showRootHelp();
70
74
  return;
71
75
  }
@@ -114,6 +118,7 @@ class Help extends HelpBase {
114
118
  console.log('');
115
119
  }
116
120
  if (rootCommands.length > 0) {
121
+ rootCommands = rootCommands.filter(c => c.id);
117
122
  console.log(this.formatCommands(rootCommands));
118
123
  console.log('');
119
124
  }
@@ -202,3 +207,4 @@ class Help extends HelpBase {
202
207
  }
203
208
  }
204
209
  exports.default = Help;
210
+ exports.Help = Help;
@@ -1 +1 @@
1
- {"version":"3.0.0-rc1.2","commands":{"help":{"id":"help","description":"display help for <%= config.bin %>","pluginName":"@oclif/plugin-help","pluginType":"core","aliases":[],"flags":{"all":{"name":"all","type":"boolean","description":"see all commands in CLI","allowNo":false}},"args":[{"name":"command","description":"command to show help for","required":false}]}}}
1
+ {"version":"3.2.0","commands":{"help":{"id":"help","description":"display help for <%= config.bin %>","pluginName":"@oclif/plugin-help","pluginType":"core","aliases":[],"flags":{"all":{"name":"all","type":"boolean","description":"see all commands in CLI","allowNo":false}},"args":[{"name":"command","description":"command to show help for","required":false}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/plugin-help",
3
3
  "description": "standard help for oclif",
4
- "version": "3.0.0-rc1.2",
4
+ "version": "3.2.0",
5
5
  "author": "Jeff Dickey @jdxcode",
6
6
  "bugs": "https://github.com/oclif/plugin-help/issues",
7
7
  "dependencies": {
@@ -10,9 +10,9 @@
10
10
  "chalk": "^2.4.1",
11
11
  "indent-string": "^4.0.0",
12
12
  "lodash.template": "^4.4.0",
13
- "string-width": "^3.0.0",
14
- "strip-ansi": "^5.0.0",
15
- "widest-line": "^2.0.1",
13
+ "string-width": "^4.2.0",
14
+ "strip-ansi": "^6.0.0",
15
+ "widest-line": "^3.1.0",
16
16
  "wrap-ansi": "^4.0.0"
17
17
  },
18
18
  "devDependencies": {
@@ -23,19 +23,20 @@
23
23
  "@oclif/test": "^1.2.2",
24
24
  "@types/chai": "^4.1.7",
25
25
  "@types/lodash.template": "^4.4.4",
26
- "@types/mocha": "^5.2.5",
27
- "@types/node": "^8.10.59",
28
- "@types/strip-ansi": "^3.0.0",
26
+ "@types/mocha": "^8.0.0",
27
+ "@types/node": "^14.0.14",
28
+ "@types/strip-ansi": "^5.2.1",
29
29
  "@types/wrap-ansi": "^3.0.0",
30
30
  "chai": "^4.2.0",
31
- "eslint": "^6.6.0",
31
+ "eslint": "^7.3.1",
32
32
  "eslint-config-oclif": "^3.1.0",
33
- "eslint-config-oclif-typescript": "^0.1.0",
34
- "globby": "^9.0.0",
33
+ "eslint-config-oclif-typescript": "^0.2.0",
34
+ "globby": "^11.0.1",
35
35
  "mocha": "^5.2.0",
36
+ "nock": "^13.0.0",
36
37
  "sinon": "^9.0.1",
37
38
  "ts-node": "^8.8.2",
38
- "typescript": "^3.8.3"
39
+ "typescript": "3.8.3"
39
40
  },
40
41
  "engines": {
41
42
  "node": ">=8.0.0"
@@ -62,7 +63,7 @@
62
63
  "scripts": {
63
64
  "build": "rm -rf lib && tsc",
64
65
  "lint": "eslint . --ext .ts --config .eslintrc",
65
- "pretest": "tsc -p test --noEmit",
66
+ "pretest": "yarn build --noEmit && tsc -p test --noEmit",
66
67
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
67
68
  "posttest": "yarn lint",
68
69
  "prepack": "yarn run build && oclif-dev manifest",