update help for list and help command
All checks were successful
Go Action / goaction (pull_request) Successful in 37s
All checks were successful
Go Action / goaction (pull_request) Successful in 37s
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user