@clerc/plugin-help 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.
- package/dist/index.d.ts +8 -3
- package/dist/index.js +3 -2
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -124,9 +124,13 @@ interface HelpPluginOptions {
|
|
|
124
124
|
*/
|
|
125
125
|
examples?: [string, string][];
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
127
|
+
* Header to show before the help output.
|
|
128
128
|
*/
|
|
129
|
-
|
|
129
|
+
header?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Footer to show after the help output.
|
|
132
|
+
*/
|
|
133
|
+
footer?: string;
|
|
130
134
|
/**
|
|
131
135
|
* Custom formatters for rendering help.
|
|
132
136
|
*/
|
|
@@ -145,7 +149,8 @@ declare const helpPlugin: ({
|
|
|
145
149
|
showHelpWhenNoCommandSpecified,
|
|
146
150
|
notes,
|
|
147
151
|
examples,
|
|
148
|
-
|
|
152
|
+
header,
|
|
153
|
+
footer,
|
|
149
154
|
formatters,
|
|
150
155
|
groups
|
|
151
156
|
}?: HelpPluginOptions) => Plugin;
|
package/dist/index.js
CHANGED
|
@@ -296,7 +296,7 @@ function addStoreApi(cli, { groups }) {
|
|
|
296
296
|
|
|
297
297
|
//#endregion
|
|
298
298
|
//#region src/index.ts
|
|
299
|
-
const helpPlugin = ({ command = true, flag = true, showHelpWhenNoCommandSpecified = true, notes, examples,
|
|
299
|
+
const helpPlugin = ({ command = true, flag = true, showHelpWhenNoCommandSpecified = true, notes, examples, header, footer, formatters, groups = {} } = {}) => definePlugin({ setup: (cli) => {
|
|
300
300
|
addStoreApi(cli, { groups });
|
|
301
301
|
const mergedFormatters = {
|
|
302
302
|
...defaultFormatters,
|
|
@@ -315,8 +315,9 @@ const helpPlugin = ({ command = true, flag = true, showHelpWhenNoCommandSpecifie
|
|
|
315
315
|
const effectiveNotes = notes ?? generalHelpNotes;
|
|
316
316
|
const getEffectiveExamples = () => examples ?? getGeneralHelpExamples();
|
|
317
317
|
function printHelp(s) {
|
|
318
|
-
if (
|
|
318
|
+
if (header) console.log(header);
|
|
319
319
|
console.log(s);
|
|
320
|
+
if (footer) console.log(footer);
|
|
320
321
|
}
|
|
321
322
|
const renderer = new HelpRenderer(mergedFormatters, cli, cli._globalFlags, () => groups, getEffectiveExamples, effectiveNotes);
|
|
322
323
|
function tryPrintSubcommandsHelp(commandName) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/plugin-help",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
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 help",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"kons": "^0.7.1",
|
|
55
|
-
"@clerc/core": "1.0.0-beta.
|
|
56
|
-
"@clerc/
|
|
57
|
-
"@clerc/
|
|
55
|
+
"@clerc/core": "1.0.0-beta.28",
|
|
56
|
+
"@clerc/utils": "1.0.0-beta.28",
|
|
57
|
+
"@clerc/parser": "1.0.0-beta.28"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@clerc/core": "*"
|