Commit 8758dc05 by Iwasaki Yudai

Isolate help message template

1 parent 25627da8
Showing with 21 additions and 18 deletions
package main
var helpTemplate = `NAME:
{{.Name}} - {{.Usage}}
USAGE:
{{.Name}} [options] <command> [<arguments...>]
VERSION:
{{.Version}}{{if or .Author .Email}}
AUTHOR:{{if .Author}}
{{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}}
{{.Email}}{{end}}{{end}}
OPTIONS:
{{range .Flags}}{{.}}
{{end}}
`
...@@ -14,6 +14,7 @@ func main() { ...@@ -14,6 +14,7 @@ func main() {
cmd.Version = "0.0.2" cmd.Version = "0.0.2"
cmd.Name = "gotty" cmd.Name = "gotty"
cmd.Usage = "Share your terminal as a web application" cmd.Usage = "Share your terminal as a web application"
cmd.HideHelp = true
cmd.Flags = []cli.Flag{ cmd.Flags = []cli.Flag{
cli.StringFlag{ cli.StringFlag{
Name: "addr, a", Name: "addr, a",
...@@ -66,24 +67,7 @@ func main() { ...@@ -66,24 +67,7 @@ func main() {
} }
} }
cmd.HideHelp = true cli.AppHelpTemplate = helpTemplate
cli.AppHelpTemplate = `NAME:
{{.Name}} - {{.Usage}}
USAGE:
{{.Name}} [options] <command> [<arguments...>]
VERSION:
{{.Version}}{{if or .Author .Email}}
AUTHOR:{{if .Author}}
{{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}}
{{.Email}}{{end}}{{end}}
OPTIONS:
{{range .Flags}}{{.}}
{{end}}
`
cmd.Run(os.Args) cmd.Run(os.Args)
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!