Skip to content

Commit 07a2abf

Browse files
committed
cleanup help template
1 parent 6d7a25a commit 07a2abf

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

help.go

Lines changed: 0 additions & 15 deletions
This file was deleted.

main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@ import (
1414
"github.com/tomatool/tomato/tomato"
1515
)
1616

17+
// AppHelpTemplate is the text template for the Default help topic.
18+
// cli.go uses text/template to render templates. You can
19+
// render custom help text by setting this variable.
20+
const AppHelpTemplate = `Usage: {{if .UsageText}}{{.UsageText}}{{else}}tomato {{if .VisibleFlags}}[options]{{end}}{{if .ArgsUsage}}{{.ArgsUsage}}{{else}} <config path>{{end}}{{end}}
21+
22+
Options:
23+
{{range $index, $option := .VisibleFlags}}{{if $index}}
24+
{{end}}{{$option}}{{end}}
25+
`
26+
1727
func main() {
28+
cli.AppHelpTemplate = AppHelpTemplate
29+
1830
log := log.New(os.Stdout, "", 0)
1931

2032
app := cli.NewApp()

main_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"testing"
1010
)
1111

12-
func init() {}
13-
1412
func TestMain(t *testing.T) {
1513
var args []string
1614
for _, arg := range os.Args {

0 commit comments

Comments
 (0)