@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.
- package/package.json +1 -1
- package/src/help.js +15 -0
package/package.json
CHANGED
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"));
|