@forwardimpact/libcli 0.1.5 → 0.1.6

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/package.json +1 -1
  2. package/src/help.js +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/libcli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Shared CLI infrastructure for the Forward Impact monorepo",
5
5
  "license": "Apache-2.0",
6
6
  "author": "D. Olsson <hi@senzilla.io>",
package/src/help.js CHANGED
@@ -83,6 +83,20 @@ export class HelpRenderer {
83
83
  return this.#renderExamplesArray(definition.examples);
84
84
  }
85
85
 
86
+ #renderDocumentation(definition) {
87
+ if (!definition.documentation || definition.documentation.length === 0) {
88
+ return [];
89
+ }
90
+ const lines = [this.#sectionHeader("Documentation:")];
91
+ for (const entry of definition.documentation) {
92
+ lines.push(` ${entry.title}`);
93
+ lines.push(` ${entry.url}`);
94
+ if (entry.description) lines.push(` ${entry.description}`);
95
+ }
96
+ lines.push("");
97
+ return lines;
98
+ }
99
+
86
100
  #renderHintLine(definition) {
87
101
  if (!definition.commands || definition.commands.length === 0) return [];
88
102
  return [
@@ -135,6 +149,7 @@ export class HelpRenderer {
135
149
  ...this.#renderCommands(definition),
136
150
  ...this.#renderOptionSection(definition.globalOptions, "Options:"),
137
151
  ...this.#renderExamples(definition),
152
+ ...this.#renderDocumentation(definition),
138
153
  ...this.#renderHintLine(definition),
139
154
  ];
140
155
  out.write(lines.join("\n"));