Update cobra dependency to v1.1.1
Cobra v1.1.1 brings improvements to autocompletion needed for ongoing kubectl work. Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>
This commit is contained in:
12
vendor/github.com/spf13/cobra/doc/README.md
generated
vendored
Normal file
12
vendor/github.com/spf13/cobra/doc/README.md
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Documentation generation
|
||||
|
||||
- [Man page docs](./man_docs.md)
|
||||
- [Markdown docs](./md_docs.md)
|
||||
- [Rest docs](./rest_docs.md)
|
||||
- [Yaml docs](./yaml_docs.md)
|
||||
|
||||
## Options
|
||||
### `DisableAutoGenTag`
|
||||
You may set `cmd.DisableAutoGenTag = true`
|
||||
to _entirely_ remove the auto generated string "Auto generated by spf13/cobra..."
|
||||
from any documentation source.
|
||||
10
vendor/github.com/spf13/cobra/doc/man_docs.go
generated
vendored
10
vendor/github.com/spf13/cobra/doc/man_docs.go
generated
vendored
@@ -105,7 +105,7 @@ func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
|
||||
if header == nil {
|
||||
header = &GenManHeader{}
|
||||
}
|
||||
if err := fillHeader(header, cmd.CommandPath()); err != nil {
|
||||
if err := fillHeader(header, cmd.CommandPath(), cmd.DisableAutoGenTag); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func fillHeader(header *GenManHeader, name string) error {
|
||||
func fillHeader(header *GenManHeader, name string, disableAutoGen bool) error {
|
||||
if header.Title == "" {
|
||||
header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1))
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func fillHeader(header *GenManHeader, name string) error {
|
||||
header.Date = &now
|
||||
}
|
||||
header.date = (*header.Date).Format("Jan 2006")
|
||||
if header.Source == "" {
|
||||
if header.Source == "" && !disableAutoGen {
|
||||
header.Source = "Auto generated by spf13/cobra"
|
||||
}
|
||||
return nil
|
||||
@@ -145,9 +145,7 @@ func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, da
|
||||
description = cmd.Short
|
||||
}
|
||||
|
||||
buf.WriteString(fmt.Sprintf(`%% %s(%s)%s
|
||||
%% %s
|
||||
%% %s
|
||||
buf.WriteString(fmt.Sprintf(`%% "%s" "%s" "%s" "%s" "%s"
|
||||
# NAME
|
||||
`, header.Title, header.Section, header.date, header.Source, header.Manual))
|
||||
buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short))
|
||||
|
||||
14
vendor/github.com/spf13/cobra/doc/md_docs.go
generated
vendored
14
vendor/github.com/spf13/cobra/doc/md_docs.go
generated
vendored
@@ -58,16 +58,12 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
|
||||
buf := new(bytes.Buffer)
|
||||
name := cmd.CommandPath()
|
||||
|
||||
short := cmd.Short
|
||||
long := cmd.Long
|
||||
if len(long) == 0 {
|
||||
long = short
|
||||
}
|
||||
|
||||
buf.WriteString("## " + name + "\n\n")
|
||||
buf.WriteString(short + "\n\n")
|
||||
buf.WriteString("### Synopsis\n\n")
|
||||
buf.WriteString(long + "\n\n")
|
||||
buf.WriteString(cmd.Short + "\n\n")
|
||||
if len(cmd.Long) > 0 {
|
||||
buf.WriteString("### Synopsis\n\n")
|
||||
buf.WriteString(cmd.Long + "\n\n")
|
||||
}
|
||||
|
||||
if cmd.Runnable() {
|
||||
buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.UseLine()))
|
||||
|
||||
2
vendor/github.com/spf13/cobra/doc/util.go
generated
vendored
2
vendor/github.com/spf13/cobra/doc/util.go
generated
vendored
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
// Test to see if we have a reason to print See Also information in docs
|
||||
// Basically this is a test for a parent commend or a subcommand which is
|
||||
// Basically this is a test for a parent command or a subcommand which is
|
||||
// both not deprecated and not the autogenerated help command.
|
||||
func hasSeeAlso(cmd *cobra.Command) bool {
|
||||
if cmd.HasParent() {
|
||||
|
||||
5
vendor/github.com/spf13/cobra/doc/yaml_docs.go
generated
vendored
5
vendor/github.com/spf13/cobra/doc/yaml_docs.go
generated
vendored
@@ -37,6 +37,7 @@ type cmdDoc struct {
|
||||
Name string
|
||||
Synopsis string `yaml:",omitempty"`
|
||||
Description string `yaml:",omitempty"`
|
||||
Usage string `yaml:",omitempty"`
|
||||
Options []cmdOption `yaml:",omitempty"`
|
||||
InheritedOptions []cmdOption `yaml:"inherited_options,omitempty"`
|
||||
Example string `yaml:",omitempty"`
|
||||
@@ -98,6 +99,10 @@ func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) str
|
||||
yamlDoc.Synopsis = forceMultiLine(cmd.Short)
|
||||
yamlDoc.Description = forceMultiLine(cmd.Long)
|
||||
|
||||
if cmd.Runnable() {
|
||||
yamlDoc.Usage = cmd.UseLine()
|
||||
}
|
||||
|
||||
if len(cmd.Example) > 0 {
|
||||
yamlDoc.Example = cmd.Example
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user