@xmorse/cac 6.0.3 → 6.0.5

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/deno/Command.ts CHANGED
@@ -144,21 +144,17 @@ class Command {
144
144
  title: 'Usage',
145
145
  body: ` $ ${name} ${this.usageText || this.rawName}`
146
146
  });
147
-
148
- // Show full description for specific commands (not global/default)
149
- if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) {
150
- sections.push({
151
- title: 'Description',
152
- body: this.description.split('\n').map(line => ` ${line}`).join('\n')
153
- });
154
- }
155
147
  const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
156
148
  if (showCommands) {
157
149
  const longestCommandName = findLongest(commands.map(command => command.rawName));
158
150
  sections.push({
159
151
  title: 'Commands',
160
152
  body: commands.map(command => {
161
- return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
153
+ const descLines = command.description.split('\n').map(line => line.trim()).filter(line => line.length > 0);
154
+ const firstLine = descLines[0] || '';
155
+ const restLines = descLines.slice(1);
156
+ const padding = ' ' + ' '.repeat(longestCommandName.length) + ' ';
157
+ return [` ${padRight(command.rawName, longestCommandName.length)} ${firstLine}`, ...restLines.map(line => `${padding} ${line}`)].join('\n');
162
158
  }).join('\n')
163
159
  });
164
160
  sections.push({
@@ -179,6 +175,14 @@ class Command {
179
175
  }).join('\n')
180
176
  });
181
177
  }
178
+
179
+ // Show full description for specific commands (not global/default)
180
+ if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) {
181
+ sections.push({
182
+ title: 'Description',
183
+ body: this.description.split('\n').map(line => ` ${line}`).join('\n')
184
+ });
185
+ }
182
186
  if (this.examples.length > 0) {
183
187
  sections.push({
184
188
  title: 'Examples',
package/dist/index.js CHANGED
@@ -352,19 +352,20 @@ class Command {
352
352
  title: "Usage",
353
353
  body: ` $ ${name} ${this.usageText || this.rawName}`
354
354
  });
355
- if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) {
356
- sections.push({
357
- title: "Description",
358
- body: this.description.split("\n").map((line) => ` ${line}`).join("\n")
359
- });
360
- }
361
355
  const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
362
356
  if (showCommands) {
363
357
  const longestCommandName = findLongest(commands.map((command) => command.rawName));
364
358
  sections.push({
365
359
  title: "Commands",
366
360
  body: commands.map((command) => {
367
- return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
361
+ const descLines = command.description.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
362
+ const firstLine = descLines[0] || "";
363
+ const restLines = descLines.slice(1);
364
+ const padding = " " + " ".repeat(longestCommandName.length) + " ";
365
+ return [
366
+ ` ${padRight(command.rawName, longestCommandName.length)} ${firstLine}`,
367
+ ...restLines.map((line) => `${padding} ${line}`)
368
+ ].join("\n");
368
369
  }).join("\n")
369
370
  });
370
371
  sections.push({
@@ -385,6 +386,12 @@ class Command {
385
386
  }).join("\n")
386
387
  });
387
388
  }
389
+ if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) {
390
+ sections.push({
391
+ title: "Description",
392
+ body: this.description.split("\n").map((line) => ` ${line}`).join("\n")
393
+ });
394
+ }
388
395
  if (this.examples.length > 0) {
389
396
  sections.push({
390
397
  title: "Examples",
package/dist/index.mjs CHANGED
@@ -348,19 +348,20 @@ class Command {
348
348
  title: "Usage",
349
349
  body: ` $ ${name} ${this.usageText || this.rawName}`
350
350
  });
351
- if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) {
352
- sections.push({
353
- title: "Description",
354
- body: this.description.split("\n").map((line) => ` ${line}`).join("\n")
355
- });
356
- }
357
351
  const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
358
352
  if (showCommands) {
359
353
  const longestCommandName = findLongest(commands.map((command) => command.rawName));
360
354
  sections.push({
361
355
  title: "Commands",
362
356
  body: commands.map((command) => {
363
- return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
357
+ const descLines = command.description.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
358
+ const firstLine = descLines[0] || "";
359
+ const restLines = descLines.slice(1);
360
+ const padding = " " + " ".repeat(longestCommandName.length) + " ";
361
+ return [
362
+ ` ${padRight(command.rawName, longestCommandName.length)} ${firstLine}`,
363
+ ...restLines.map((line) => `${padding} ${line}`)
364
+ ].join("\n");
364
365
  }).join("\n")
365
366
  });
366
367
  sections.push({
@@ -381,6 +382,12 @@ class Command {
381
382
  }).join("\n")
382
383
  });
383
384
  }
385
+ if (!this.isGlobalCommand && !this.isDefaultCommand && this.description) {
386
+ sections.push({
387
+ title: "Description",
388
+ body: this.description.split("\n").map((line) => ` ${line}`).join("\n")
389
+ });
390
+ }
384
391
  if (this.examples.length > 0) {
385
392
  sections.push({
386
393
  title: "Examples",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmorse/cac",
3
- "version": "6.0.3",
3
+ "version": "6.0.5",
4
4
  "description": "Simple yet powerful framework for building command-line apps.",
5
5
  "repository": {
6
6
  "url": "egoist/cac",