update help for list and help command
All checks were successful
Go Action / goaction (pull_request) Successful in 37s

This commit is contained in:
2026-01-06 16:45:56 +03:00
parent 7b4dc88d8b
commit 85edd5acec
3 changed files with 8 additions and 15 deletions

View File

@@ -126,8 +126,7 @@ func Execute(ctx context.Context, in config.Provider, out output.Output) error {
return nil
}
const tpl = `
The <info>%[2]s</info> command displays help for a given command:
const tpl = `The <info>%[2]s</info> command displays help for a given command:
<info>%[1]s %[2]s list</info>
You can also output the help in other formats by using the <comment>--format</comment> option:
<info>%[1]s %[2]s --format=xml list</info>

View File

@@ -6,14 +6,12 @@ import (
"gitoa.ru/go-4devs/console/setting"
)
const tpl = `
The <info>%[2]s</info> command lists all commands:
const tpl = `The <info>%[2]s</info> command lists all commands:
<info>%[1]s %[2]s</info>
You can also display the commands for a specific namespace:
<info>%[1]s %[2]s test</info>
You can also output the information in other formats by using the <comment>--format</comment> option:
<info>%[1]s %[2]s --format=xml</info>
`
<info>%[1]s %[2]s --format=xml</info>`
func Help(data setting.HData) (string, error) {
return fmt.Sprintf(tpl, data.Bin, data.Name), nil

View File

@@ -29,7 +29,8 @@ var (
"commands": txtCommands,
}
txtHelpTemplate = template.Must(template.New("txt_template").
txtHelpTemplate = template.Must(
template.New("txt_template").
Funcs(txtFunc).
Parse(`
{{- if .Description -}}
@@ -38,8 +39,8 @@ var (
{{ end -}}
{{- usage . }}
{{- definition .Options }}
{{- help . }}
`))
{{- help . }}`),
)
txtListTemplate = template.Must(template.New("txt_list").
Funcs(txtFunc).
@@ -149,12 +150,7 @@ func txtHelp(cmd Command) string {
return ""
}
var buf bytes.Buffer
buf.WriteString("\n<comment>Help:</comment>")
buf.WriteString(cmd.Help)
return buf.String()
return "\n<comment>Help:</comment>\n" + cmd.Help + "\n"
}
func txtDefinition(options config.Options) string {