Skip to content
Myr

refactor: replace several vars with consts (#2328)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by htoyoda18 · committed by GitHub · parent e2dd29d · Browse files · 1 file+5 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−5 removed

  • other:+5 added−5 removed

1 file+5 added−5 removed

modified:command.go+5 added-5 removed
565 unmodified lines
566 }567 return c.parent.commandsMaxUseLen568}569570var minCommandPathPadding = 11570const minCommandPathPadding = 11571572// CommandPathPadding return padding for the command path.573func (c *Command) CommandPathPadding() int {574 if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen {
1 unmodified line
576 }577 return c.parent.commandsMaxCommandPathLen578}579580var minNamePadding = 11580const minNamePadding = 11581582// NamePadding returns padding for the name.583func (c *Command) NamePadding() int {584 if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen {
1353 unmodified lines
1938 tmpl string1939 fn func(io.Writer, interface{}) error1940}19411942var defaultUsageTemplate = `Usage:{{if .Runnable}}1942const defaultUsageTemplate = `Usage:{{if .Runnable}}1943 {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}1944 {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}19451946Aliases:
91 unmodified lines
2038 fmt.Fprintln(w)2039 return nil2040}20412042var defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}2042const defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}20432044{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`20452046// defaultHelpFunc is equivalent to executing defaultHelpTemplate. The two should be changed in sync.
13 unmodified lines
2060 }2061 return nil2062}20632064var defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}}2064const defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}}2065`20662067// defaultVersionFunc is equivalent to executing defaultVersionTemplate. The two should be changed in sync.2068func defaultVersionFunc(w io.Writer, in interface{}) error {
4 unmodified lines