From 50b52ca9d52b24529cdfeb6dcbff3aa80b69922f Mon Sep 17 00:00:00 2001 From: Michael Schuett Date: Sun, 27 Jan 2019 17:25:59 -0500 Subject: [PATCH] Fix unit tests --- app_test.go | 75 ++++++++++++++++++++++++++++++----------------------- help.go | 5 ++-- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/app_test.go b/app_test.go index ceb0ee9..f779d69 100644 --- a/app_test.go +++ b/app_test.go @@ -1381,20 +1381,23 @@ func TestApp_VisibleCategories(t *testing.T) { app.HideHelp = true app.Commands = []Command{ { - Name: "command1", - Category: "1", - HelpName: "foo command1", - Hidden: true, + Name: "command1", + Category: "1", + HelpName: "foo command1", + Hidden: true, + FlagCategories: FlagCategories{}, }, { - Name: "command2", - Category: "2", - HelpName: "foo command2", + Name: "command2", + Category: "2", + HelpName: "foo command2", + FlagCategories: FlagCategories{}, }, { - Name: "command3", - Category: "3", - HelpName: "foo command3", + Name: "command3", + Category: "3", + HelpName: "foo command3", + FlagCategories: FlagCategories{}, }, } @@ -1421,21 +1424,24 @@ func TestApp_VisibleCategories(t *testing.T) { app.HideHelp = true app.Commands = []Command{ { - Name: "command1", - Category: "1", - HelpName: "foo command1", - Hidden: true, + Name: "command1", + Category: "1", + HelpName: "foo command1", + Hidden: true, + FlagCategories: FlagCategories{}, }, { - Name: "command2", - Category: "2", - HelpName: "foo command2", - Hidden: true, + Name: "command2", + Category: "2", + HelpName: "foo command2", + Hidden: true, + FlagCategories: FlagCategories{}, }, { - Name: "command3", - Category: "3", - HelpName: "foo command3", + Name: "command3", + Category: "3", + HelpName: "foo command3", + FlagCategories: FlagCategories{}, }, } @@ -1456,22 +1462,25 @@ func TestApp_VisibleCategories(t *testing.T) { app.HideHelp = true app.Commands = []Command{ { - Name: "command1", - Category: "1", - HelpName: "foo command1", - Hidden: true, + Name: "command1", + Category: "1", + HelpName: "foo command1", + Hidden: true, + FlagCategories: FlagCategories{}, }, { - Name: "command2", - Category: "2", - HelpName: "foo command2", - Hidden: true, + Name: "command2", + Category: "2", + HelpName: "foo command2", + Hidden: true, + FlagCategories: FlagCategories{}, }, { - Name: "command3", - Category: "3", - HelpName: "foo command3", - Hidden: true, + Name: "command3", + Category: "3", + HelpName: "foo command3", + Hidden: true, + FlagCategories: FlagCategories{}, }, } diff --git a/help.go b/help.go index 18e185e..b80bac3 100644 --- a/help.go +++ b/help.go @@ -54,12 +54,11 @@ CATEGORY: {{.Category}}{{end}}{{if .Description}} DESCRIPTION: - {{.Description}}{{end}} - + {{.Description}}{{end}}{{if .VisibleFlagCategories}} OPTIONS:{{range .VisibleFlagCategories}} {{.Name}} {{range .VisibleFlags}}{{.}} - {{end}}{{end}} + {{end}}{{end}}{{end}} ` // SubcommandHelpTemplate is the text template for the subcommand help topic.