mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
Merge branch 'master' into bugfix/consistent-error-reporting-when-called-with-unknown-subcommand
This commit is contained in:
commit
b65aa6f9b3
3 changed files with 5 additions and 4 deletions
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extentions"
|
BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions"
|
||||||
BashCompCustom = "cobra_annotation_bash_completion_custom"
|
BashCompCustom = "cobra_annotation_bash_completion_custom"
|
||||||
BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
|
BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
|
||||||
BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
|
BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
|
||||||
|
|
|
@ -929,14 +929,15 @@ func TestRootUnknownCommand(t *testing.T) {
|
||||||
|
|
||||||
func TestRootUnknownCommandSilenced(t *testing.T) {
|
func TestRootUnknownCommandSilenced(t *testing.T) {
|
||||||
r := noRRSetupTestSilenced("bogus")
|
r := noRRSetupTestSilenced("bogus")
|
||||||
|
s := "Run 'cobra-test --help' for usage.\n"
|
||||||
|
|
||||||
if r.Output != "" {
|
if r.Output != "" {
|
||||||
t.Errorf("Unexpected response.\nExpecting to be: \n\"\"\n Got:\n %q\n", r.Output)
|
t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output)
|
||||||
}
|
}
|
||||||
|
|
||||||
r = noRRSetupTestSilenced("--strtwo=a bogus")
|
r = noRRSetupTestSilenced("--strtwo=a bogus")
|
||||||
if r.Output != "" {
|
if r.Output != "" {
|
||||||
t.Errorf("Unexpected response.\nExpecting to be:\n\"\"\nGot:\n %q\n", r.Output)
|
t.Errorf("Unexpected response.\nExpecting to be:\n %q\nGot:\n %q\n", s, r.Output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -993,7 +993,7 @@ func (c *Command) IsHelpCommand() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasHelpSubCommands determines if a command has any avilable 'help' sub commands
|
// HasHelpSubCommands determines if a command has any available 'help' sub commands
|
||||||
// that need to be shown in the usage/help default template under 'additional help
|
// that need to be shown in the usage/help default template under 'additional help
|
||||||
// topics'
|
// topics'
|
||||||
func (c *Command) HasHelpSubCommands() bool {
|
func (c *Command) HasHelpSubCommands() bool {
|
||||||
|
|
Loading…
Reference in a new issue