forked from TrueCloudLab/rclone
vendor: update all dependencies
This commit is contained in:
parent
3f0789e2db
commit
08021c4636
2474 changed files with 435818 additions and 282709 deletions
2
vendor/github.com/spf13/cobra/.circleci/config.yml
generated
vendored
2
vendor/github.com/spf13/cobra/.circleci/config.yml
generated
vendored
|
@ -13,7 +13,7 @@ base: &base
|
|||
name: "All Commands"
|
||||
command: |
|
||||
mkdir -p bin
|
||||
curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck
|
||||
curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.6/shellcheck
|
||||
chmod +x bin/shellcheck
|
||||
go get -t -v ./...
|
||||
PATH=$PATH:$PWD/bin go test -v ./...
|
||||
|
|
29
vendor/github.com/spf13/cobra/bash_completions.go
generated
vendored
29
vendor/github.com/spf13/cobra/bash_completions.go
generated
vendored
|
@ -251,6 +251,14 @@ __%[1]s_handle_word()
|
|||
__%[1]s_handle_command
|
||||
elif [[ $c -eq 0 ]]; then
|
||||
__%[1]s_handle_command
|
||||
elif __%[1]s_contains_word "${words[c]}" "${command_aliases[@]}"; then
|
||||
# aliashash variable is an associative array which is only supported in bash > 3.
|
||||
if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
|
||||
words[c]=${aliashash[${words[c]}]}
|
||||
__%[1]s_handle_command
|
||||
else
|
||||
__%[1]s_handle_noun
|
||||
fi
|
||||
else
|
||||
__%[1]s_handle_noun
|
||||
fi
|
||||
|
@ -266,6 +274,7 @@ func writePostscript(buf *bytes.Buffer, name string) {
|
|||
buf.WriteString(fmt.Sprintf(`{
|
||||
local cur prev words cword
|
||||
declare -A flaghash 2>/dev/null || :
|
||||
declare -A aliashash 2>/dev/null || :
|
||||
if declare -F _init_completion >/dev/null 2>&1; then
|
||||
_init_completion -s || return
|
||||
else
|
||||
|
@ -305,6 +314,7 @@ func writeCommands(buf *bytes.Buffer, cmd *Command) {
|
|||
continue
|
||||
}
|
||||
buf.WriteString(fmt.Sprintf(" commands+=(%q)\n", c.Name()))
|
||||
writeCmdAliases(buf, c)
|
||||
}
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
|
@ -443,6 +453,21 @@ func writeRequiredNouns(buf *bytes.Buffer, cmd *Command) {
|
|||
}
|
||||
}
|
||||
|
||||
func writeCmdAliases(buf *bytes.Buffer, cmd *Command) {
|
||||
if len(cmd.Aliases) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
sort.Sort(sort.StringSlice(cmd.Aliases))
|
||||
|
||||
buf.WriteString(fmt.Sprint(` if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then`, "\n"))
|
||||
for _, value := range cmd.Aliases {
|
||||
buf.WriteString(fmt.Sprintf(" command_aliases+=(%q)\n", value))
|
||||
buf.WriteString(fmt.Sprintf(" aliashash[%q]=%q\n", value, cmd.Name()))
|
||||
}
|
||||
buf.WriteString(` fi`)
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
func writeArgAliases(buf *bytes.Buffer, cmd *Command) {
|
||||
buf.WriteString(" noun_aliases=()\n")
|
||||
sort.Sort(sort.StringSlice(cmd.ArgAliases))
|
||||
|
@ -469,6 +494,10 @@ func gen(buf *bytes.Buffer, cmd *Command) {
|
|||
}
|
||||
|
||||
buf.WriteString(fmt.Sprintf(" last_command=%q\n", commandName))
|
||||
buf.WriteString("\n")
|
||||
buf.WriteString(" command_aliases=()\n")
|
||||
buf.WriteString("\n")
|
||||
|
||||
writeCommands(buf, cmd)
|
||||
writeFlags(buf, cmd)
|
||||
writeRequiredFlag(buf, cmd)
|
||||
|
|
2
vendor/github.com/spf13/cobra/bash_completions.md
generated
vendored
2
vendor/github.com/spf13/cobra/bash_completions.md
generated
vendored
|
@ -181,7 +181,7 @@ a custom flag completion function with cobra.BashCompCustom:
|
|||
|
||||
```go
|
||||
annotation := make(map[string][]string)
|
||||
annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"}
|
||||
annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"}
|
||||
|
||||
flag := &pflag.Flag{
|
||||
Name: "namespace",
|
||||
|
|
2
vendor/github.com/spf13/cobra/cobra/cmd/init.go
generated
vendored
2
vendor/github.com/spf13/cobra/cobra/cmd/init.go
generated
vendored
|
@ -65,7 +65,7 @@ Init will not use an existing directory with contents.`,
|
|||
initializeProject(project)
|
||||
|
||||
fmt.Fprintln(cmd.OutOrStdout(), `Your Cobra application is ready at
|
||||
`+project.AbsPath()+`.
|
||||
`+project.AbsPath()+`
|
||||
|
||||
Give it a try by going there and running `+"`go run main.go`."+`
|
||||
Add commands to it by running `+"`cobra add [cmdname]`.")
|
||||
|
|
10
vendor/github.com/spf13/cobra/command.go
generated
vendored
10
vendor/github.com/spf13/cobra/command.go
generated
vendored
|
@ -27,6 +27,9 @@ import (
|
|||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// FParseErrWhitelist configures Flag parse errors to be ignored
|
||||
type FParseErrWhitelist flag.ParseErrorsWhitelist
|
||||
|
||||
// Command is just that, a command for your application.
|
||||
// E.g. 'go run ...' - 'run' is the command. Cobra requires
|
||||
// you to define the usage and description as part of your command
|
||||
|
@ -137,6 +140,9 @@ type Command struct {
|
|||
// TraverseChildren parses flags on all parents before executing child command.
|
||||
TraverseChildren bool
|
||||
|
||||
//FParseErrWhitelist flag parse errors to be ignored
|
||||
FParseErrWhitelist FParseErrWhitelist
|
||||
|
||||
// commands is the list of commands supported by this program.
|
||||
commands []*Command
|
||||
// parent is a parent command for this command.
|
||||
|
@ -1463,6 +1469,10 @@ func (c *Command) ParseFlags(args []string) error {
|
|||
}
|
||||
beforeErrorBufLen := c.flagErrorBuf.Len()
|
||||
c.mergePersistentFlags()
|
||||
|
||||
//do it here after merging all flags and just before parse
|
||||
c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)
|
||||
|
||||
err := c.Flags().Parse(args)
|
||||
// Print warnings if they occurred (e.g. deprecated flag messages).
|
||||
if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil {
|
||||
|
|
105
vendor/github.com/spf13/cobra/command_test.go
generated
vendored
105
vendor/github.com/spf13/cobra/command_test.go
generated
vendored
|
@ -1626,3 +1626,108 @@ func TestCalledAs(t *testing.T) {
|
|||
t.Run(name, tc.test)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFParseErrWhitelistBackwardCompatibility(t *testing.T) {
|
||||
c := &Command{Use: "c", Run: emptyRun}
|
||||
c.Flags().BoolP("boola", "a", false, "a boolean flag")
|
||||
|
||||
output, err := executeCommand(c, "c", "-a", "--unknown", "flag")
|
||||
if err == nil {
|
||||
t.Error("expected unknown flag error")
|
||||
}
|
||||
checkStringContains(t, output, "unknown flag: --unknown")
|
||||
}
|
||||
|
||||
func TestFParseErrWhitelistSameCommand(t *testing.T) {
|
||||
c := &Command{
|
||||
Use: "c",
|
||||
Run: emptyRun,
|
||||
FParseErrWhitelist: FParseErrWhitelist{
|
||||
UnknownFlags: true,
|
||||
},
|
||||
}
|
||||
c.Flags().BoolP("boola", "a", false, "a boolean flag")
|
||||
|
||||
_, err := executeCommand(c, "c", "-a", "--unknown", "flag")
|
||||
if err != nil {
|
||||
t.Error("unexpected error: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFParseErrWhitelistParentCommand(t *testing.T) {
|
||||
root := &Command{
|
||||
Use: "root",
|
||||
Run: emptyRun,
|
||||
FParseErrWhitelist: FParseErrWhitelist{
|
||||
UnknownFlags: true,
|
||||
},
|
||||
}
|
||||
|
||||
c := &Command{
|
||||
Use: "child",
|
||||
Run: emptyRun,
|
||||
}
|
||||
c.Flags().BoolP("boola", "a", false, "a boolean flag")
|
||||
|
||||
root.AddCommand(c)
|
||||
|
||||
output, err := executeCommand(root, "child", "-a", "--unknown", "flag")
|
||||
if err == nil {
|
||||
t.Error("expected unknown flag error")
|
||||
}
|
||||
checkStringContains(t, output, "unknown flag: --unknown")
|
||||
}
|
||||
|
||||
func TestFParseErrWhitelistChildCommand(t *testing.T) {
|
||||
root := &Command{
|
||||
Use: "root",
|
||||
Run: emptyRun,
|
||||
}
|
||||
|
||||
c := &Command{
|
||||
Use: "child",
|
||||
Run: emptyRun,
|
||||
FParseErrWhitelist: FParseErrWhitelist{
|
||||
UnknownFlags: true,
|
||||
},
|
||||
}
|
||||
c.Flags().BoolP("boola", "a", false, "a boolean flag")
|
||||
|
||||
root.AddCommand(c)
|
||||
|
||||
_, err := executeCommand(root, "child", "-a", "--unknown", "flag")
|
||||
if err != nil {
|
||||
t.Error("unexpected error: ", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestFParseErrWhitelistSiblingCommand(t *testing.T) {
|
||||
root := &Command{
|
||||
Use: "root",
|
||||
Run: emptyRun,
|
||||
}
|
||||
|
||||
c := &Command{
|
||||
Use: "child",
|
||||
Run: emptyRun,
|
||||
FParseErrWhitelist: FParseErrWhitelist{
|
||||
UnknownFlags: true,
|
||||
},
|
||||
}
|
||||
c.Flags().BoolP("boola", "a", false, "a boolean flag")
|
||||
|
||||
s := &Command{
|
||||
Use: "sibling",
|
||||
Run: emptyRun,
|
||||
}
|
||||
s.Flags().BoolP("boolb", "b", false, "a boolean flag")
|
||||
|
||||
root.AddCommand(c)
|
||||
root.AddCommand(s)
|
||||
|
||||
output, err := executeCommand(root, "sibling", "-b", "--unknown", "flag")
|
||||
if err == nil {
|
||||
t.Error("expected unknown flag error")
|
||||
}
|
||||
checkStringContains(t, output, "unknown flag: --unknown")
|
||||
}
|
||||
|
|
4
vendor/github.com/spf13/cobra/doc/man_docs.go
generated
vendored
4
vendor/github.com/spf13/cobra/doc/man_docs.go
generated
vendored
|
@ -176,13 +176,13 @@ func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) {
|
|||
|
||||
func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) {
|
||||
flags := command.NonInheritedFlags()
|
||||
if flags.HasFlags() {
|
||||
if flags.HasAvailableFlags() {
|
||||
buf.WriteString("# OPTIONS\n")
|
||||
manPrintFlags(buf, flags)
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
flags = command.InheritedFlags()
|
||||
if flags.HasFlags() {
|
||||
if flags.HasAvailableFlags() {
|
||||
buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n")
|
||||
manPrintFlags(buf, flags)
|
||||
buf.WriteString("\n")
|
||||
|
|
36
vendor/github.com/spf13/cobra/doc/man_docs_test.go
generated
vendored
36
vendor/github.com/spf13/cobra/doc/man_docs_test.go
generated
vendored
|
@ -47,6 +47,42 @@ func TestGenManDoc(t *testing.T) {
|
|||
checkStringContains(t, output, translate("Auto generated"))
|
||||
}
|
||||
|
||||
func TestGenManNoHiddenParents(t *testing.T) {
|
||||
header := &GenManHeader{
|
||||
Title: "Project",
|
||||
Section: "2",
|
||||
}
|
||||
|
||||
// We generate on a subcommand so we have both subcommands and parents
|
||||
for _, name := range []string{"rootflag", "strtwo"} {
|
||||
f := rootCmd.PersistentFlags().Lookup(name)
|
||||
f.Hidden = true
|
||||
defer func() { f.Hidden = false }()
|
||||
}
|
||||
buf := new(bytes.Buffer)
|
||||
if err := GenMan(echoCmd, header, buf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := buf.String()
|
||||
|
||||
// Make sure parent has - in CommandPath() in SEE ALSO:
|
||||
parentPath := echoCmd.Parent().CommandPath()
|
||||
dashParentPath := strings.Replace(parentPath, " ", "-", -1)
|
||||
expected := translate(dashParentPath)
|
||||
expected = expected + "(" + header.Section + ")"
|
||||
checkStringContains(t, output, expected)
|
||||
|
||||
checkStringContains(t, output, translate(echoCmd.Name()))
|
||||
checkStringContains(t, output, translate(echoCmd.Name()))
|
||||
checkStringContains(t, output, "boolone")
|
||||
checkStringOmits(t, output, "rootflag")
|
||||
checkStringContains(t, output, translate(rootCmd.Name()))
|
||||
checkStringContains(t, output, translate(echoSubCmd.Name()))
|
||||
checkStringOmits(t, output, translate(deprecatedCmd.Name()))
|
||||
checkStringContains(t, output, translate("Auto generated"))
|
||||
checkStringOmits(t, output, "OPTIONS INHERITED FROM PARENT COMMANDS")
|
||||
}
|
||||
|
||||
func TestGenManNoGenTag(t *testing.T) {
|
||||
echoCmd.DisableAutoGenTag = true
|
||||
defer func() { echoCmd.DisableAutoGenTag = false }()
|
||||
|
|
4
vendor/github.com/spf13/cobra/doc/md_docs.go
generated
vendored
4
vendor/github.com/spf13/cobra/doc/md_docs.go
generated
vendored
|
@ -29,7 +29,7 @@ import (
|
|||
func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
|
||||
flags := cmd.NonInheritedFlags()
|
||||
flags.SetOutput(buf)
|
||||
if flags.HasFlags() {
|
||||
if flags.HasAvailableFlags() {
|
||||
buf.WriteString("### Options\n\n```\n")
|
||||
flags.PrintDefaults()
|
||||
buf.WriteString("```\n\n")
|
||||
|
@ -37,7 +37,7 @@ func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
|
|||
|
||||
parentFlags := cmd.InheritedFlags()
|
||||
parentFlags.SetOutput(buf)
|
||||
if parentFlags.HasFlags() {
|
||||
if parentFlags.HasAvailableFlags() {
|
||||
buf.WriteString("### Options inherited from parent commands\n\n```\n")
|
||||
parentFlags.PrintDefaults()
|
||||
buf.WriteString("```\n\n")
|
||||
|
|
24
vendor/github.com/spf13/cobra/doc/md_docs_test.go
generated
vendored
24
vendor/github.com/spf13/cobra/doc/md_docs_test.go
generated
vendored
|
@ -25,6 +25,30 @@ func TestGenMdDoc(t *testing.T) {
|
|||
checkStringContains(t, output, rootCmd.Short)
|
||||
checkStringContains(t, output, echoSubCmd.Short)
|
||||
checkStringOmits(t, output, deprecatedCmd.Short)
|
||||
checkStringContains(t, output, "Options inherited from parent commands")
|
||||
}
|
||||
|
||||
func TestGenMdNoHiddenParents(t *testing.T) {
|
||||
// We generate on subcommand so we have both subcommands and parents.
|
||||
for _, name := range []string{"rootflag", "strtwo"} {
|
||||
f := rootCmd.PersistentFlags().Lookup(name)
|
||||
f.Hidden = true
|
||||
defer func() { f.Hidden = false }()
|
||||
}
|
||||
buf := new(bytes.Buffer)
|
||||
if err := GenMarkdown(echoCmd, buf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := buf.String()
|
||||
|
||||
checkStringContains(t, output, echoCmd.Long)
|
||||
checkStringContains(t, output, echoCmd.Example)
|
||||
checkStringContains(t, output, "boolone")
|
||||
checkStringOmits(t, output, "rootflag")
|
||||
checkStringContains(t, output, rootCmd.Short)
|
||||
checkStringContains(t, output, echoSubCmd.Short)
|
||||
checkStringOmits(t, output, deprecatedCmd.Short)
|
||||
checkStringOmits(t, output, "Options inherited from parent commands")
|
||||
}
|
||||
|
||||
func TestGenMdNoTag(t *testing.T) {
|
||||
|
|
4
vendor/github.com/spf13/cobra/doc/rest_docs.go
generated
vendored
4
vendor/github.com/spf13/cobra/doc/rest_docs.go
generated
vendored
|
@ -29,7 +29,7 @@ import (
|
|||
func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
|
||||
flags := cmd.NonInheritedFlags()
|
||||
flags.SetOutput(buf)
|
||||
if flags.HasFlags() {
|
||||
if flags.HasAvailableFlags() {
|
||||
buf.WriteString("Options\n")
|
||||
buf.WriteString("~~~~~~~\n\n::\n\n")
|
||||
flags.PrintDefaults()
|
||||
|
@ -38,7 +38,7 @@ func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error
|
|||
|
||||
parentFlags := cmd.InheritedFlags()
|
||||
parentFlags.SetOutput(buf)
|
||||
if parentFlags.HasFlags() {
|
||||
if parentFlags.HasAvailableFlags() {
|
||||
buf.WriteString("Options inherited from parent commands\n")
|
||||
buf.WriteString("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n")
|
||||
parentFlags.PrintDefaults()
|
||||
|
|
23
vendor/github.com/spf13/cobra/doc/rest_docs_test.go
generated
vendored
23
vendor/github.com/spf13/cobra/doc/rest_docs_test.go
generated
vendored
|
@ -27,6 +27,29 @@ func TestGenRSTDoc(t *testing.T) {
|
|||
checkStringOmits(t, output, deprecatedCmd.Short)
|
||||
}
|
||||
|
||||
func TestGenRSTNoHiddenParents(t *testing.T) {
|
||||
// We generate on a subcommand so we have both subcommands and parents
|
||||
for _, name := range []string{"rootflag", "strtwo"} {
|
||||
f := rootCmd.PersistentFlags().Lookup(name)
|
||||
f.Hidden = true
|
||||
defer func() { f.Hidden = false }()
|
||||
}
|
||||
buf := new(bytes.Buffer)
|
||||
if err := GenReST(echoCmd, buf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := buf.String()
|
||||
|
||||
checkStringContains(t, output, echoCmd.Long)
|
||||
checkStringContains(t, output, echoCmd.Example)
|
||||
checkStringContains(t, output, "boolone")
|
||||
checkStringOmits(t, output, "rootflag")
|
||||
checkStringContains(t, output, rootCmd.Short)
|
||||
checkStringContains(t, output, echoSubCmd.Short)
|
||||
checkStringOmits(t, output, deprecatedCmd.Short)
|
||||
checkStringOmits(t, output, "Options inherited from parent commands")
|
||||
}
|
||||
|
||||
func TestGenRSTNoTag(t *testing.T) {
|
||||
rootCmd.DisableAutoGenTag = true
|
||||
defer func() { rootCmd.DisableAutoGenTag = false }()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue