@clerc/plugin-help 1.0.0-beta.6 → 1.0.0-beta.7

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 -6
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -21,6 +21,8 @@ const DEFAULT_GROUP_KEY = "default";
21
21
  const table = (items) => textTable(items, { stringLength: stringWidth });
22
22
  const splitTable = (items) => table(items).split("\n");
23
23
  const DELIMITER = yc.yellow("-");
24
+ const INDENT = " ".repeat(2);
25
+ const withIndent = (str) => `${INDENT}${str}`;
24
26
  function groupDefinitionsToMap(definitions) {
25
27
  const map = /* @__PURE__ */ new Map();
26
28
  if (definitions) for (const [key, name] of definitions) map.set(key, name);
@@ -53,7 +55,7 @@ var HelpRenderer = class {
53
55
  ].filter(isTruthy).filter((section) => section.body.length > 0).map((section) => {
54
56
  const body = Array.isArray(section.body) ? section.body.filter((s) => s !== void 0).join("\n") : section.body;
55
57
  if (!section.title) return body;
56
- return `${yc.bold(section.title)}\n${body.split("\n").map((line) => ` ${line}`).join("\n")}`;
58
+ return `${yc.bold(section.title)}\n${body.split("\n").map(withIndent).join("\n")}`;
57
59
  }).join("\n\n");
58
60
  }
59
61
  renderHeader() {
@@ -76,7 +78,7 @@ var HelpRenderer = class {
76
78
  if (command?.flags && !objectIsEmpty(command.flags) || !objectIsEmpty(this._globalFlags)) usage += " [flags]";
77
79
  return {
78
80
  title: "Usage",
79
- body: [usage]
81
+ body: [yc.magenta(usage)]
80
82
  };
81
83
  }
82
84
  renderCommands() {
@@ -101,13 +103,13 @@ var HelpRenderer = class {
101
103
  if (items && items.length > 0) {
102
104
  if (body.length > 0) body.push("");
103
105
  body.push(`${yc.dim(name)}`);
104
- for (const line of splitTable(items)) body.push(` ${line}`);
106
+ body.push(...splitTable(items).map(withIndent));
105
107
  }
106
108
  }
107
109
  if (defaultCommands.length > 0) if (body.length > 0) {
108
110
  body.push("");
109
111
  body.push(`${yc.dim("Other")}`);
110
- for (const line of splitTable(defaultCommands)) body.push(` ${line}`);
112
+ body.push(...splitTable(defaultCommands).map(withIndent));
111
113
  } else body.push(...splitTable(defaultCommands));
112
114
  return {
113
115
  title: "Commands",
@@ -144,13 +146,13 @@ var HelpRenderer = class {
144
146
  if (items && items.length > 0) {
145
147
  if (body.length > 0) body.push("");
146
148
  body.push(`${yc.dim(name)}`);
147
- for (const line of splitTable(items)) body.push(` ${line}`);
149
+ body.push(...splitTable(items).map(withIndent));
148
150
  }
149
151
  }
150
152
  if (defaultFlags.length > 0) if (body.length > 0) {
151
153
  body.push("");
152
154
  body.push(`${yc.dim("Other")}`);
153
- for (const line of splitTable(defaultFlags)) body.push(` ${line}`);
155
+ body.push(...splitTable(defaultFlags).map(withIndent));
154
156
  } else body.push(...splitTable(defaultFlags));
155
157
  return body;
156
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-help",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.7",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin help",
@@ -49,11 +49,11 @@
49
49
  "string-width": "^8.1.0",
50
50
  "text-table": "^0.2.0",
51
51
  "yoctocolors": "^2.1.2",
52
- "@clerc/utils": "1.0.0-beta.6"
52
+ "@clerc/utils": "1.0.0-beta.7"
53
53
  },
54
54
  "devDependencies": {
55
- "@clerc/parser": "1.0.0-beta.6",
56
- "@clerc/core": "1.0.0-beta.6"
55
+ "@clerc/core": "1.0.0-beta.7",
56
+ "@clerc/parser": "1.0.0-beta.7"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@clerc/core": "*"