Commit 23c8c741 authored by zaccoding's avatar zaccoding Committed by Martin Holst Swende

cmd: fix command help messages in modules (#20203)

parent 06763201
...@@ -32,19 +32,6 @@ import ( ...@@ -32,19 +32,6 @@ import (
"gopkg.in/urfave/cli.v1" "gopkg.in/urfave/cli.v1"
) )
const (
commandHelperTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...]
{{if .Description}}{{.Description}}
{{end}}{{if .Subcommands}}
SUBCOMMANDS:
{{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}}{{end}}{{if .Flags}}
OPTIONS:
{{range $.Flags}}{{"\t"}}{{.}}
{{end}}
{{end}}`
)
var ( var (
// Git SHA1 commit hash of the release (set via linker flags) // Git SHA1 commit hash of the release (set via linker flags)
gitCommit = "" gitCommit = ""
...@@ -128,7 +115,7 @@ func init() { ...@@ -128,7 +115,7 @@ func init() {
aliasFlag, aliasFlag,
} }
app.Action = utils.MigrateFlags(abigen) app.Action = utils.MigrateFlags(abigen)
cli.CommandHelpTemplate = commandHelperTemplate cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
} }
func abigen(c *cli.Context) error { func abigen(c *cli.Context) error {
......
...@@ -28,19 +28,6 @@ import ( ...@@ -28,19 +28,6 @@ import (
"gopkg.in/urfave/cli.v1" "gopkg.in/urfave/cli.v1"
) )
const (
commandHelperTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...]
{{if .Description}}{{.Description}}
{{end}}{{if .Subcommands}}
SUBCOMMANDS:
{{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}}{{end}}{{if .Flags}}
OPTIONS:
{{range $.Flags}}{{"\t"}}{{.}}
{{end}}
{{end}}`
)
var ( var (
// Git SHA1 commit hash of the release (set via linker flags) // Git SHA1 commit hash of the release (set via linker flags)
gitCommit = "" gitCommit = ""
...@@ -61,7 +48,7 @@ func init() { ...@@ -61,7 +48,7 @@ func init() {
oracleFlag, oracleFlag,
nodeURLFlag, nodeURLFlag,
} }
cli.CommandHelpTemplate = commandHelperTemplate cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
} }
// Commonly used command line flags. // Commonly used command line flags.
......
...@@ -223,6 +223,7 @@ func init() { ...@@ -223,6 +223,7 @@ func init() {
} }
app.Action = signer app.Action = signer
app.Commands = []cli.Command{initCommand, attestCommand, setCredentialCommand, delCredentialCommand, gendocCommand} app.Commands = []cli.Command{initCommand, attestCommand, setCredentialCommand, delCredentialCommand, gendocCommand}
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
} }
func main() { func main() {
......
...@@ -43,6 +43,7 @@ func init() { ...@@ -43,6 +43,7 @@ func init() {
commandSignMessage, commandSignMessage,
commandVerifyMessage, commandVerifyMessage,
} }
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
} }
// Commonly used command line flags. // Commonly used command line flags.
......
...@@ -152,6 +152,7 @@ func init() { ...@@ -152,6 +152,7 @@ func init() {
runCommand, runCommand,
stateTestCommand, stateTestCommand,
} }
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
} }
func main() { func main() {
......
...@@ -77,6 +77,17 @@ SUBCOMMANDS: ...@@ -77,6 +77,17 @@ SUBCOMMANDS:
{{range $categorized.Flags}}{{"\t"}}{{.}} {{range $categorized.Flags}}{{"\t"}}{{.}}
{{end}} {{end}}
{{end}}{{end}}` {{end}}{{end}}`
OriginCommandHelpTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...]
{{if .Description}}{{.Description}}
{{end}}{{if .Subcommands}}
SUBCOMMANDS:
{{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}}{{end}}{{if .Flags}}
OPTIONS:
{{range $.Flags}}{{"\t"}}{{.}}
{{end}}
{{end}}`
) )
func init() { func init() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment