@clerc/plugin-help 0.24.0 → 0.25.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/dist/index.js CHANGED
@@ -46,7 +46,7 @@ const renderCliffy = (sections) => {
46
46
  const body = formattedBody.join("\n");
47
47
  rendered.push(table([pc.bold(`${section.title}:`)], [body]).toString());
48
48
  } else if (section.type === "inline") {
49
- const formattedBody = section.items.map((item) => [pc.bold(item.title), item.body]);
49
+ const formattedBody = section.items.map((item) => [pc.bold(`${item.title}:`), item.body]);
50
50
  const tableGenerated = table(...formattedBody);
51
51
  rendered.push(tableGenerated.toString());
52
52
  }
@@ -64,7 +64,7 @@ const renderTyper = (sections) => {
64
64
  padding: 0.5
65
65
  }));
66
66
  } else if (section.type === "inline") {
67
- const formattedBody = section.items.map((item) => [pc.bold(item.title), item.body]);
67
+ const formattedBody = section.items.map((item) => [pc.bold(`${item.title}:`), item.body]);
68
68
  const tableGenerated = table(...formattedBody);
69
69
  rendered.push(tableGenerated.toString());
70
70
  }
@@ -75,10 +75,10 @@ const renderTyper = (sections) => {
75
75
 
76
76
  const DELIMITER = pc.yellow("-");
77
77
  const NO_DESCRIPTION = "(No description)";
78
- const NAME = "Name:";
79
- const VERSION = "Version:";
80
- const COMMANDS = "Commands";
78
+ const NAME = "Name";
79
+ const VERSION = "Version";
81
80
  const SUBCOMMAND = "Subcommand";
81
+ const COMMANDS = "Commands";
82
82
  const FLAGS = "Flags";
83
83
  const DESCRIPTION = "Description";
84
84
  const USAGE = "Usage";
@@ -165,9 +165,12 @@ const generateSubcommandHelp = (render, ctx, command) => {
165
165
  throw new NoSuchCommandError(formatCommandName(command));
166
166
  }
167
167
  const sections = [];
168
- generateCliDetail(sections, cli, subcommand);
168
+ generateCliDetail(sections, cli, {
169
+ ...subcommand,
170
+ name: formatCommandName(command)
171
+ });
169
172
  const parameters = ((_a = subcommand.parameters) == null ? void 0 : _a.join(" ")) || void 0;
170
- const commandName = ctx.name === Root ? "" : ` ${formatCommandName(subcommand.name)}`;
173
+ const commandName = ` ${formatCommandName(command)}`;
171
174
  const parametersString = parameters ? ` ${parameters}` : "";
172
175
  const flagsString = subcommand.flags ? " [flags]" : "";
173
176
  sections.push({
@@ -259,6 +262,8 @@ const helpPlugin = ({
259
262
  } else {
260
263
  printHelp(generateSubcommandHelp(render, ctx, ctx.raw._));
261
264
  }
265
+ } else {
266
+ printHelp(generateSubcommandHelp(render, ctx, ctx.raw._));
262
267
  }
263
268
  } else {
264
269
  printHelp(generateHelp(render, ctx, notes, examples));
package/dist/index.mjs CHANGED
@@ -46,7 +46,7 @@ const renderCliffy = (sections) => {
46
46
  const body = formattedBody.join("\n");
47
47
  rendered.push(table([pc.bold(`${section.title}:`)], [body]).toString());
48
48
  } else if (section.type === "inline") {
49
- const formattedBody = section.items.map((item) => [pc.bold(item.title), item.body]);
49
+ const formattedBody = section.items.map((item) => [pc.bold(`${item.title}:`), item.body]);
50
50
  const tableGenerated = table(...formattedBody);
51
51
  rendered.push(tableGenerated.toString());
52
52
  }
@@ -64,7 +64,7 @@ const renderTyper = (sections) => {
64
64
  padding: 0.5
65
65
  }));
66
66
  } else if (section.type === "inline") {
67
- const formattedBody = section.items.map((item) => [pc.bold(item.title), item.body]);
67
+ const formattedBody = section.items.map((item) => [pc.bold(`${item.title}:`), item.body]);
68
68
  const tableGenerated = table(...formattedBody);
69
69
  rendered.push(tableGenerated.toString());
70
70
  }
@@ -75,10 +75,10 @@ const renderTyper = (sections) => {
75
75
 
76
76
  const DELIMITER = pc.yellow("-");
77
77
  const NO_DESCRIPTION = "(No description)";
78
- const NAME = "Name:";
79
- const VERSION = "Version:";
80
- const COMMANDS = "Commands";
78
+ const NAME = "Name";
79
+ const VERSION = "Version";
81
80
  const SUBCOMMAND = "Subcommand";
81
+ const COMMANDS = "Commands";
82
82
  const FLAGS = "Flags";
83
83
  const DESCRIPTION = "Description";
84
84
  const USAGE = "Usage";
@@ -165,9 +165,12 @@ const generateSubcommandHelp = (render, ctx, command) => {
165
165
  throw new NoSuchCommandError(formatCommandName(command));
166
166
  }
167
167
  const sections = [];
168
- generateCliDetail(sections, cli, subcommand);
168
+ generateCliDetail(sections, cli, {
169
+ ...subcommand,
170
+ name: formatCommandName(command)
171
+ });
169
172
  const parameters = ((_a = subcommand.parameters) == null ? void 0 : _a.join(" ")) || void 0;
170
- const commandName = ctx.name === Root ? "" : ` ${formatCommandName(subcommand.name)}`;
173
+ const commandName = ` ${formatCommandName(command)}`;
171
174
  const parametersString = parameters ? ` ${parameters}` : "";
172
175
  const flagsString = subcommand.flags ? " [flags]" : "";
173
176
  sections.push({
@@ -259,6 +262,8 @@ const helpPlugin = ({
259
262
  } else {
260
263
  printHelp(generateSubcommandHelp(render, ctx, ctx.raw._));
261
264
  }
265
+ } else {
266
+ printHelp(generateSubcommandHelp(render, ctx, ctx.raw._));
262
267
  }
263
268
  } else {
264
269
  printHelp(generateHelp(render, ctx, notes, examples));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-help",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc plugin help",
6
6
  "keywords": [
@@ -54,11 +54,11 @@
54
54
  "boxen": "^7.0.1",
55
55
  "get-func-name": "^2.0.0",
56
56
  "picocolors": "^1.0.0",
57
- "@clerc/toolkit": "0.24.0",
58
- "@clerc/utils": "0.24.0"
57
+ "@clerc/toolkit": "0.25.1",
58
+ "@clerc/utils": "0.25.1"
59
59
  },
60
60
  "devDependencies": {
61
- "@clerc/core": "0.24.0"
61
+ "@clerc/core": "0.25.1"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "puild",