|
|
|
@ -511,6 +511,36 @@ func TestShowSubcommandHelp_CommandUsageText(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestShowSubcommandHelp_MultiLine_CommandUsageText(t *testing.T) {
|
|
|
|
|
app := &App{
|
|
|
|
|
Commands: []*Command{
|
|
|
|
|
{
|
|
|
|
|
Name: "frobbly",
|
|
|
|
|
UsageText: `This is a
|
|
|
|
|
multi
|
|
|
|
|
line
|
|
|
|
|
UsageText`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output := &bytes.Buffer{}
|
|
|
|
|
app.Writer = output
|
|
|
|
|
|
|
|
|
|
_ = app.Run([]string{"foo", "frobbly", "--help"})
|
|
|
|
|
|
|
|
|
|
expected := `USAGE:
|
|
|
|
|
This is a
|
|
|
|
|
multi
|
|
|
|
|
line
|
|
|
|
|
UsageText
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
if !strings.Contains(output.String(), expected) {
|
|
|
|
|
t.Errorf("expected output to include usage text; got: %q", output.String())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestShowSubcommandHelp_SubcommandUsageText(t *testing.T) {
|
|
|
|
|
app := &App{
|
|
|
|
|
Commands: []*Command{
|
|
|
|
@ -535,6 +565,40 @@ func TestShowSubcommandHelp_SubcommandUsageText(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestShowSubcommandHelp_MultiLine_SubcommandUsageText(t *testing.T) {
|
|
|
|
|
app := &App{
|
|
|
|
|
Commands: []*Command{
|
|
|
|
|
{
|
|
|
|
|
Name: "frobbly",
|
|
|
|
|
Subcommands: []*Command{
|
|
|
|
|
{
|
|
|
|
|
Name: "bobbly",
|
|
|
|
|
UsageText: `This is a
|
|
|
|
|
multi
|
|
|
|
|
line
|
|
|
|
|
UsageText`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output := &bytes.Buffer{}
|
|
|
|
|
app.Writer = output
|
|
|
|
|
_ = app.Run([]string{"foo", "frobbly", "bobbly", "--help"})
|
|
|
|
|
|
|
|
|
|
expected := `USAGE:
|
|
|
|
|
This is a
|
|
|
|
|
multi
|
|
|
|
|
line
|
|
|
|
|
UsageText
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
if !strings.Contains(output.String(), expected) {
|
|
|
|
|
t.Errorf("expected output to include usage text; got: %q", output.String())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestShowAppHelp_HiddenCommand(t *testing.T) {
|
|
|
|
|
app := &App{
|
|
|
|
|
Commands: []*Command{
|
|
|
|
@ -780,6 +844,56 @@ VERSION:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestShowAppHelp_UsageText(t *testing.T) {
|
|
|
|
|
app := &App{
|
|
|
|
|
UsageText: "This is a sinlge line of UsageText",
|
|
|
|
|
Commands: []*Command{
|
|
|
|
|
{
|
|
|
|
|
Name: "frobbly",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output := &bytes.Buffer{}
|
|
|
|
|
app.Writer = output
|
|
|
|
|
|
|
|
|
|
_ = app.Run([]string{"foo"})
|
|
|
|
|
|
|
|
|
|
if !strings.Contains(output.String(), "This is a sinlge line of UsageText") {
|
|
|
|
|
t.Errorf("expected output to include usage text; got: %q", output.String())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestShowAppHelp_MultiLine_UsageText(t *testing.T) {
|
|
|
|
|
app := &App{
|
|
|
|
|
UsageText: `This is a
|
|
|
|
|
multi
|
|
|
|
|
line
|
|
|
|
|
App UsageText`,
|
|
|
|
|
Commands: []*Command{
|
|
|
|
|
{
|
|
|
|
|
Name: "frobbly",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output := &bytes.Buffer{}
|
|
|
|
|
app.Writer = output
|
|
|
|
|
|
|
|
|
|
_ = app.Run([]string{"foo"})
|
|
|
|
|
|
|
|
|
|
expected := `USAGE:
|
|
|
|
|
This is a
|
|
|
|
|
multi
|
|
|
|
|
line
|
|
|
|
|
App UsageText
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
if !strings.Contains(output.String(), expected) {
|
|
|
|
|
t.Errorf("expected output to include usage text; got: %q", output.String())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestHideHelpCommand(t *testing.T) {
|
|
|
|
|
app := &App{
|
|
|
|
|
HideHelpCommand: true,
|
|
|
|
|