Skip to content

Commit 33af9aa

Browse files
committed
feat(plugin-help)!: rename banner to header and added footer
1 parent 5f0d09f commit 33af9aa

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

docs/official-plugins/plugin-help.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ const cli = Clerc.create()
183183
["my-cli --help", "Show help information"],
184184
["my-cli hello", "Execute greeting command"],
185185
],
186-
banner: "Welcome to My CLI application!", // Custom banner
186+
header: "Welcome to My CLI application!", // Custom header
187+
footer: "Thank you for using My CLI application!", // Custom footer
187188
formatters: {
188189
// Custom type formatting functions
189190
formatTypeValue: (type) => {

docs/zh/official-plugins/plugin-help.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ const cli = Clerc.create()
180180
["my-cli --help", "显示帮助信息"],
181181
["my-cli hello", "执行问候命令"],
182182
],
183-
banner: "欢迎使用 My CLI 应用程序!", // 自定义横幅
183+
header: "欢迎使用 My CLI 应用程序!", // 自定义头部信息
184+
footer: "感谢使用 My CLI 应用程序!", // 自定义尾部信息
184185
formatters: {
185186
// 自定义类型格式化函数
186187
formatTypeValue: (type) => {

packages/plugin-help/src/index.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ export interface HelpPluginOptions {
8181
*/
8282
examples?: [string, string][];
8383
/**
84-
* A banner to show before the help output.
84+
* Header to show before the help output.
8585
*/
86-
banner?: string;
86+
header?: string;
87+
/**
88+
* Footer to show after the help output.
89+
*/
90+
footer?: string;
8791
/**
8892
* Custom formatters for rendering help.
8993
*/
@@ -103,7 +107,8 @@ export const helpPlugin = ({
103107
showHelpWhenNoCommandSpecified = true,
104108
notes,
105109
examples,
106-
banner,
110+
header,
111+
footer,
107112
formatters,
108113
groups = {},
109114
}: HelpPluginOptions = {}): Plugin =>
@@ -140,10 +145,13 @@ export const helpPlugin = ({
140145
const getEffectiveExamples = () => examples ?? getGeneralHelpExamples();
141146

142147
function printHelp(s: string) {
143-
if (banner) {
144-
console.log(banner);
148+
if (header) {
149+
console.log(header);
145150
}
146151
console.log(s);
152+
if (footer) {
153+
console.log(footer);
154+
}
147155
}
148156

149157
const renderer = new HelpRenderer(

0 commit comments

Comments
 (0)