Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore showing subcommand list #288

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions common/defs-cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,11 @@ DESCRIPTION:
{{template "descriptionTemplate" .}}{{end}}{{if .UsageText}}

USAGE:
{{wrap .UsageText 3 | markdown2Text}}{{end}}{{if .VisibleFlagCategories}}
{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}}
{{wrap .UsageText 3 | markdown2Text | trimSpace}}{{end}}{{if .VisibleCommands}}

DISPLAY OPTIONS:
{{template "visibleFlagTemplate" .}}{{end}}
COMMANDS:{{template "visibleCommandCategoryTemplate" .}}{{end}}{{if .VisibleFlagCategories}}

OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}}

OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}
`
1 change: 1 addition & 0 deletions helpprinter/helpprinter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func HelpPrinter() func(w io.Writer, templ string, data interface{}, customFunc
return func(w io.Writer, templ string, data interface{}, customFunc map[string]interface{}) {
cfs := template.FuncMap{
"markdown2Text": MarkdownToText,
"trimSpace": strings.TrimSpace,
}

_helpPrinterOrig(w, templ, data, cfs)
Expand Down
84 changes: 84 additions & 0 deletions tests/help_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package tests

func (s *e2eSuite) TestHelp_PrintsCommands() {
s.T().Skip("Skipped because downloaded dev server has old update implementation")
s.T().Parallel()

testserver, app, writer := s.setUpTestEnvironment()
defer func() {
_ = testserver.Stop()
}()

err := app.Run([]string{"", "--help"})
s.NoError(err)

tests := []struct {
want string
}{
{"workflow"},
{"Operations performed on Workflows"},
{"schedule"},
{"Operations performed on Schedules"},
}

for _, tt := range tests {
s.Contains(writer.GetContent(), tt.want)
}
}

func (s *e2eSuite) TestHelp_PrintsSubcommands() {
s.T().Skip("Skipped because downloaded dev server has old update implementation")
s.T().Parallel()

testserver, app, writer := s.setUpTestEnvironment()
defer func() {
_ = testserver.Stop()
}()

err := app.Run([]string{"", "workflow", "--help"})
s.NoError(err)

tests := []struct {
want string
}{
{"start"},
{"Starts a new Workflow Execution"},
{"list"},
{"List Workflow Executions based on a Query"},
}

for _, tt := range tests {
s.Contains(writer.GetContent(), tt.want)
}
}

func (s *e2eSuite) TestHelp_PrintsFlags() {
s.T().Skip("Skipped because downloaded dev server has old update implementation")
s.T().Parallel()

testserver, app, writer := s.setUpTestEnvironment()
defer func() {
_ = testserver.Stop()
}()

err := app.Run([]string{"", "workflow", "list", "--help"})
s.NoError(err)

tests := []struct {
want string
}{
{"Command Options:"},
{"--query"},
{"Filter results using an SQL-like query"},
{"Display Options:"},
{"--limit"},
{"Number of items to print"},
{"Shared Options:"},
{"--address"},
{"The host and port"},
}

for _, tt := range tests {
s.Contains(writer.GetContent(), tt.want)
}
}