@clerc/plugin-completions 1.0.0-beta.26 → 1.0.0-beta.28

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 +8 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -568,7 +568,7 @@ function addStoreApi(cli, { groups }) {
568
568
 
569
569
  //#endregion
570
570
  //#region ../plugin-help/src/index.ts
571
- const helpPlugin = ({ command = true, flag = true, showHelpWhenNoCommandSpecified = true, notes, examples, banner, formatters, groups = {} } = {}) => definePlugin({ setup: (cli) => {
571
+ const helpPlugin = ({ command = true, flag = true, showHelpWhenNoCommandSpecified = true, notes, examples, header, footer, formatters, groups = {} } = {}) => definePlugin({ setup: (cli) => {
572
572
  addStoreApi(cli, { groups });
573
573
  const mergedFormatters = {
574
574
  ...defaultFormatters,
@@ -587,8 +587,9 @@ const helpPlugin = ({ command = true, flag = true, showHelpWhenNoCommandSpecifie
587
587
  const effectiveNotes = notes ?? generalHelpNotes;
588
588
  const getEffectiveExamples = () => examples ?? getGeneralHelpExamples();
589
589
  function printHelp(s) {
590
- if (banner) console.log(banner);
590
+ if (header) console.log(header);
591
591
  console.log(s);
592
+ if (footer) console.log(footer);
592
593
  }
593
594
  const renderer = new HelpRenderer(mergedFormatters, cli, cli._globalFlags, () => groups, getEffectiveExamples, effectiveNotes);
594
595
  function tryPrintSubcommandsHelp(commandName) {
@@ -1540,8 +1541,11 @@ function buildTabModel(globalFlags, commands) {
1540
1541
  registerGlobalFlags(globalFlags, t);
1541
1542
  for (const cmd of commands.values()) {
1542
1543
  if (cmd.completions?.show === false) continue;
1543
- const command = t.command(cmd.name, cmd.description ?? "");
1544
- registerGlobalFlags(globalFlags, command);
1544
+ let command = t;
1545
+ if (cmd.name !== "") {
1546
+ command = t.command(cmd.name, cmd.description ?? "");
1547
+ registerGlobalFlags(globalFlags, command);
1548
+ }
1545
1549
  for (const [flagName, def] of Object.entries(cmd.flags ?? {})) {
1546
1550
  const normalized = (0, src_exports.normalizeFlagValue)(def);
1547
1551
  const desc = normalized.description ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-completions",
3
- "version": "1.0.0-beta.26",
3
+ "version": "1.0.0-beta.28",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin completions",
@@ -51,8 +51,8 @@
51
51
  "@bomb.sh/tab": "^0.0.10"
52
52
  },
53
53
  "devDependencies": {
54
- "@clerc/core": "1.0.0-beta.26",
55
- "@clerc/utils": "1.0.0-beta.26"
54
+ "@clerc/core": "1.0.0-beta.28",
55
+ "@clerc/utils": "1.0.0-beta.28"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@clerc/core": "*"