@clerc/plugin-help 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -6
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -97,11 +97,10 @@ var HelpRenderer = class {
97
97
  return this.renderSections(sections);
98
98
  }
99
99
  renderHeader() {
100
- const { _name, _version, _description } = this._cli;
100
+ const { _scriptName, _version, _description } = this._cli;
101
101
  const command = this._command;
102
102
  const description = command ? command.description : _description;
103
- const formattedCommandName = command?.name ? ` ${tint.bold(command.name)}` : "";
104
- const headerLine = command ? `${tint.dim(_name)}${formattedCommandName}` : `${tint.bold(_name)} ${formatVersion(_version)}`;
103
+ const headerLine = `${!command || command.name === "" ? tint.bold(_scriptName) : tint.dim(_scriptName)}${command?.name ? ` ${tint.bold(command.name)}` : ""}${command ? "" : ` ${formatVersion(_version)}`}`;
105
104
  const alias = command?.alias ? `Alias${toArray(command.alias).length > 1 ? "es" : ""}: ${toArray(command.alias).map((a) => tint.bold(a)).join(", ")}` : void 0;
106
105
  return { body: [`${headerLine}${description ? ` ${DELIMITER} ${description}` : ""}`, alias] };
107
106
  }
@@ -192,7 +191,7 @@ var HelpRenderer = class {
192
191
  const prefix = `${parentCommandName} `;
193
192
  const body = this.buildGroupedCommandsBody(subcommands, prefix);
194
193
  if (body.length === 0) return null;
195
- const sections = [{ body: `${this._cli._name} ${tint.bold(parentCommandName)} not found` }, {
194
+ const sections = [{ body: `${this._cli._scriptName} ${tint.bold(parentCommandName)} not found` }, {
196
195
  title: "Available Subcommands",
197
196
  body
198
197
  }];
@@ -372,8 +371,10 @@ const helpPlugin = ({ command = true, flag = true, showHelpWhenNoCommandSpecifie
372
371
  }
373
372
  renderer.setCommand(command$1);
374
373
  printHelp(renderer.render());
375
- } else if (showHelpWhenNoCommandSpecified && !ctx.command && ctx.rawParsed.parameters.length === 0) printHelp(renderer.render());
376
- else await next();
374
+ } else if (showHelpWhenNoCommandSpecified && !ctx.command && ctx.rawParsed.parameters.length === 0) {
375
+ console.log("No command specified. Showing help:\n");
376
+ printHelp(renderer.render());
377
+ } else await next();
377
378
  }
378
379
  });
379
380
  } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-help",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin help",
@@ -52,9 +52,9 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "kons": "^0.7.1",
55
- "@clerc/parser": "1.0.0",
56
- "@clerc/utils": "1.0.0",
57
- "@clerc/core": "1.0.0"
55
+ "@clerc/core": "1.0.1",
56
+ "@clerc/utils": "1.0.1",
57
+ "@clerc/parser": "1.0.1"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@clerc/core": "*"