mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
Fixes issue references
This commit is contained in:
parent
ef632ed1e1
commit
1223d49a62
3 changed files with 10 additions and 10 deletions
|
@ -71,7 +71,7 @@ Example: cobra add server -> resulting in a new cmd/server.go`,
|
||||||
// validateCmdName returns source without any dashes and underscore.
|
// validateCmdName returns source without any dashes and underscore.
|
||||||
// If there will be dash or underscore, next letter will be uppered.
|
// If there will be dash or underscore, next letter will be uppered.
|
||||||
// It supports only ASCII (1-byte character) strings.
|
// It supports only ASCII (1-byte character) strings.
|
||||||
// https://github.com/OneCloudInc/cobra/issues/269
|
// https://github.com/spf13/cobra/issues/269
|
||||||
func validateCmdName(source string) string {
|
func validateCmdName(source string) string {
|
||||||
i := 0
|
i := 0
|
||||||
l := len(source)
|
l := len(source)
|
||||||
|
|
|
@ -1229,7 +1229,7 @@ func (c *Command) IsAvailableCommand() bool {
|
||||||
// help topic command; additional help topic command is determined by the
|
// help topic command; additional help topic command is determined by the
|
||||||
// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that
|
// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that
|
||||||
// are runnable/hidden/deprecated.
|
// are runnable/hidden/deprecated.
|
||||||
// Concrete example: https://github.com/OneCloudInc/cobra/issues/393#issuecomment-282741924.
|
// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924.
|
||||||
func (c *Command) IsAdditionalHelpTopicCommand() bool {
|
func (c *Command) IsAdditionalHelpTopicCommand() bool {
|
||||||
// if a command is runnable, deprecated, or hidden it is not a 'help' command
|
// if a command is runnable, deprecated, or hidden it is not a 'help' command
|
||||||
if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
|
if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
|
||||||
|
|
|
@ -805,7 +805,7 @@ func TestHelpFlagExecutedOnChild(t *testing.T) {
|
||||||
// TestHelpFlagInHelp checks,
|
// TestHelpFlagInHelp checks,
|
||||||
// if '--help' flag is shown in help for child (executing `parent help child`),
|
// if '--help' flag is shown in help for child (executing `parent help child`),
|
||||||
// that has no other flags.
|
// that has no other flags.
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/302.
|
// Related to https://github.com/spf13/cobra/issues/302.
|
||||||
func TestHelpFlagInHelp(t *testing.T) {
|
func TestHelpFlagInHelp(t *testing.T) {
|
||||||
parentCmd := &Command{Use: "parent", Run: func(*Command, []string) {}}
|
parentCmd := &Command{Use: "parent", Run: func(*Command, []string) {}}
|
||||||
|
|
||||||
|
@ -1205,7 +1205,7 @@ func TestPersistentHooks(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/521.
|
// Related to https://github.com/spf13/cobra/issues/521.
|
||||||
func TestGlobalNormFuncPropagation(t *testing.T) {
|
func TestGlobalNormFuncPropagation(t *testing.T) {
|
||||||
normFunc := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
normFunc := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||||
return pflag.NormalizedName(name)
|
return pflag.NormalizedName(name)
|
||||||
|
@ -1225,7 +1225,7 @@ func TestGlobalNormFuncPropagation(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/521.
|
// Related to https://github.com/spf13/cobra/issues/521.
|
||||||
func TestNormPassedOnLocal(t *testing.T) {
|
func TestNormPassedOnLocal(t *testing.T) {
|
||||||
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||||
return pflag.NormalizedName(strings.ToUpper(name))
|
return pflag.NormalizedName(strings.ToUpper(name))
|
||||||
|
@ -1239,7 +1239,7 @@ func TestNormPassedOnLocal(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/521.
|
// Related to https://github.com/spf13/cobra/issues/521.
|
||||||
func TestNormPassedOnInherited(t *testing.T) {
|
func TestNormPassedOnInherited(t *testing.T) {
|
||||||
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||||
return pflag.NormalizedName(strings.ToUpper(name))
|
return pflag.NormalizedName(strings.ToUpper(name))
|
||||||
|
@ -1267,7 +1267,7 @@ func TestNormPassedOnInherited(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/521.
|
// Related to https://github.com/spf13/cobra/issues/521.
|
||||||
func TestConsistentNormalizedName(t *testing.T) {
|
func TestConsistentNormalizedName(t *testing.T) {
|
||||||
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||||
return pflag.NormalizedName(strings.ToUpper(name))
|
return pflag.NormalizedName(strings.ToUpper(name))
|
||||||
|
@ -1400,7 +1400,7 @@ func TestFlagErrorFunc(t *testing.T) {
|
||||||
|
|
||||||
// TestSortedFlags checks,
|
// TestSortedFlags checks,
|
||||||
// if cmd.LocalFlags() is unsorted when cmd.Flags().SortFlags set to false.
|
// if cmd.LocalFlags() is unsorted when cmd.Flags().SortFlags set to false.
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/404.
|
// Related to https://github.com/spf13/cobra/issues/404.
|
||||||
func TestSortedFlags(t *testing.T) {
|
func TestSortedFlags(t *testing.T) {
|
||||||
c := &Command{}
|
c := &Command{}
|
||||||
c.Flags().SortFlags = false
|
c.Flags().SortFlags = false
|
||||||
|
@ -1426,7 +1426,7 @@ func TestSortedFlags(t *testing.T) {
|
||||||
// TestMergeCommandLineToFlags checks,
|
// TestMergeCommandLineToFlags checks,
|
||||||
// if pflag.CommandLine is correctly merged to c.Flags() after first call
|
// if pflag.CommandLine is correctly merged to c.Flags() after first call
|
||||||
// of c.mergePersistentFlags.
|
// of c.mergePersistentFlags.
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/443.
|
// Related to https://github.com/spf13/cobra/issues/443.
|
||||||
func TestMergeCommandLineToFlags(t *testing.T) {
|
func TestMergeCommandLineToFlags(t *testing.T) {
|
||||||
pflag.Bool("boolflag", false, "")
|
pflag.Bool("boolflag", false, "")
|
||||||
c := &Command{Use: "c", Run: emptyRun}
|
c := &Command{Use: "c", Run: emptyRun}
|
||||||
|
@ -1440,7 +1440,7 @@ func TestMergeCommandLineToFlags(t *testing.T) {
|
||||||
|
|
||||||
// TestUseDeprecatedFlags checks,
|
// TestUseDeprecatedFlags checks,
|
||||||
// if cobra.Execute() prints a message, if a deprecated flag is used.
|
// if cobra.Execute() prints a message, if a deprecated flag is used.
|
||||||
// Related to https://github.com/OneCloudInc/cobra/issues/463.
|
// Related to https://github.com/spf13/cobra/issues/463.
|
||||||
func TestUseDeprecatedFlags(t *testing.T) {
|
func TestUseDeprecatedFlags(t *testing.T) {
|
||||||
c := &Command{Use: "c", Run: emptyRun}
|
c := &Command{Use: "c", Run: emptyRun}
|
||||||
c.Flags().BoolP("deprecated", "d", false, "deprecated flag")
|
c.Flags().BoolP("deprecated", "d", false, "deprecated flag")
|
||||||
|
|
Loading…
Add table
Reference in a new issue