Skip to content

Commit 23c8c74

Browse files
zacscodingholiman
authored andcommitted
cmd: fix command help messages in modules (ethereum#20203)
1 parent 0676320 commit 23c8c74

File tree

6 files changed

+16
-28
lines changed

6 files changed

+16
-28
lines changed

Diff for: cmd/abigen/main.go

+1-14
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,6 @@ import (
3232
"gopkg.in/urfave/cli.v1"
3333
)
3434

35-
const (
36-
commandHelperTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...]
37-
{{if .Description}}{{.Description}}
38-
{{end}}{{if .Subcommands}}
39-
SUBCOMMANDS:
40-
{{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
41-
{{end}}{{end}}{{if .Flags}}
42-
OPTIONS:
43-
{{range $.Flags}}{{"\t"}}{{.}}
44-
{{end}}
45-
{{end}}`
46-
)
47-
4835
var (
4936
// Git SHA1 commit hash of the release (set via linker flags)
5037
gitCommit = ""
@@ -128,7 +115,7 @@ func init() {
128115
aliasFlag,
129116
}
130117
app.Action = utils.MigrateFlags(abigen)
131-
cli.CommandHelpTemplate = commandHelperTemplate
118+
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
132119
}
133120

134121
func abigen(c *cli.Context) error {

Diff for: cmd/checkpoint-admin/main.go

+1-14
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,6 @@ import (
2828
"gopkg.in/urfave/cli.v1"
2929
)
3030

31-
const (
32-
commandHelperTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...]
33-
{{if .Description}}{{.Description}}
34-
{{end}}{{if .Subcommands}}
35-
SUBCOMMANDS:
36-
{{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
37-
{{end}}{{end}}{{if .Flags}}
38-
OPTIONS:
39-
{{range $.Flags}}{{"\t"}}{{.}}
40-
{{end}}
41-
{{end}}`
42-
)
43-
4431
var (
4532
// Git SHA1 commit hash of the release (set via linker flags)
4633
gitCommit = ""
@@ -61,7 +48,7 @@ func init() {
6148
oracleFlag,
6249
nodeURLFlag,
6350
}
64-
cli.CommandHelpTemplate = commandHelperTemplate
51+
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
6552
}
6653

6754
// Commonly used command line flags.

Diff for: cmd/clef/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ func init() {
223223
}
224224
app.Action = signer
225225
app.Commands = []cli.Command{initCommand, attestCommand, setCredentialCommand, delCredentialCommand, gendocCommand}
226+
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
226227
}
227228

228229
func main() {

Diff for: cmd/ethkey/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func init() {
4343
commandSignMessage,
4444
commandVerifyMessage,
4545
}
46+
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
4647
}
4748

4849
// Commonly used command line flags.

Diff for: cmd/evm/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ func init() {
152152
runCommand,
153153
stateTestCommand,
154154
}
155+
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
155156
}
156157

157158
func main() {

Diff for: cmd/utils/flags.go

+11
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ SUBCOMMANDS:
7777
{{range $categorized.Flags}}{{"\t"}}{{.}}
7878
{{end}}
7979
{{end}}{{end}}`
80+
81+
OriginCommandHelpTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} [arguments...]
82+
{{if .Description}}{{.Description}}
83+
{{end}}{{if .Subcommands}}
84+
SUBCOMMANDS:
85+
{{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
86+
{{end}}{{end}}{{if .Flags}}
87+
OPTIONS:
88+
{{range $.Flags}}{{"\t"}}{{.}}
89+
{{end}}
90+
{{end}}`
8091
)
8192

8293
func init() {

0 commit comments

Comments
 (0)