aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/flags.go
diff options
context:
space:
mode:
authorBas van Kervel <basvankervel@gmail.com>2017-05-25 15:15:51 +0800
committerBas van Kervel <basvankervel@gmail.com>2017-05-25 15:15:51 +0800
commita346aedb90937de822e421cfa64405f9078af8a0 (patch)
tree38edc8f75e8294e7e36e6447945524c4a83b60b5 /cmd/utils/flags.go
parentef25b826e655f8e6a57fc7a05454bf356382bd5f (diff)
downloadgo-tangerine-a346aedb90937de822e421cfa64405f9078af8a0.tar.gz
go-tangerine-a346aedb90937de822e421cfa64405f9078af8a0.tar.zst
go-tangerine-a346aedb90937de822e421cfa64405f9078af8a0.zip
cmd/geth: reorganise help section for new cli flag handling
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r--cmd/utils/flags.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index df37d40c9..863761e8c 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -56,6 +56,19 @@ import (
"gopkg.in/urfave/cli.v1"
)
+var (
+ CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...]
+{{if .cmd.Description}}{{.cmd.Description}}
+{{end}}{{if .cmd.Subcommands}}
+SUBCOMMANDS:
+ {{range .cmd.Subcommands}}{{.cmd.Name}}{{with .cmd.ShortName}}, {{.cmd}}{{end}}{{ "\t" }}{{.cmd.Usage}}
+ {{end}}{{end}}{{if .categorizedFlags}}
+{{range $idx, $categorized := .categorizedFlags}}{{$categorized.Name}} OPTIONS:
+{{range $categorized.Flags}}{{"\t"}}{{.}}
+{{end}}
+{{end}}{{end}}`
+)
+
func init() {
cli.AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...]
@@ -70,16 +83,7 @@ GLOBAL OPTIONS:
{{end}}{{end}}
`
- cli.CommandHelpTemplate = `{{.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}}{{.}}
- {{end}}{{end}}
-`
+ cli.CommandHelpTemplate = CommandHelpTemplate
}
// NewApp creates an app with sane defaults.