From 81dae01a112cf9b7fe6603c0d59e75d6f3d917db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 14:06:04 +0000 Subject: [PATCH] build(deps): bump github.com/urfave/cli/v2 from 2.23.7 to 2.25.5 Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.23.7 to 2.25.5. - [Release notes](https://github.com/urfave/cli/releases) - [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md) - [Commits](https://github.com/urfave/cli/compare/v2.23.7...v2.25.5) --- updated-dependencies: - dependency-name: github.com/urfave/cli/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../github.com/andreazorzetto/yh/.gitignore | 4 - vendor/github.com/andreazorzetto/yh/README.md | 44 ----------- vendor/github.com/andreazorzetto/yh/main.go | 53 ------------- vendor/github.com/urfave/cli/v2/README.md | 8 +- vendor/github.com/urfave/cli/v2/app.go | 48 ++++++------ vendor/github.com/urfave/cli/v2/category.go | 17 ++++- vendor/github.com/urfave/cli/v2/command.go | 5 +- vendor/github.com/urfave/cli/v2/context.go | 24 +++++- vendor/github.com/urfave/cli/v2/docs.go | 11 ++- .../github.com/urfave/cli/v2/flag-spec.yaml | 16 ++++ vendor/github.com/urfave/cli/v2/flag.go | 60 +++++++++++---- vendor/github.com/urfave/cli/v2/flag_bool.go | 7 +- .../urfave/cli/v2/flag_float64_slice.go | 14 +++- .../github.com/urfave/cli/v2/flag_generic.go | 9 +-- .../urfave/cli/v2/flag_int64_slice.go | 14 +++- .../urfave/cli/v2/flag_int_slice.go | 14 +++- vendor/github.com/urfave/cli/v2/flag_path.go | 9 +-- .../github.com/urfave/cli/v2/flag_string.go | 6 +- .../urfave/cli/v2/flag_string_slice.go | 27 ++++++- .../urfave/cli/v2/flag_uint64_slice.go | 14 +++- .../urfave/cli/v2/flag_uint_slice.go | 14 +++- .../urfave/cli/v2/godoc-current.txt | 75 ++++++++++++++++--- vendor/github.com/urfave/cli/v2/help.go | 11 ++- vendor/github.com/urfave/cli/v2/sliceflag.go | 3 - .../urfave/cli/v2/sliceflag_pre18.go | 10 --- vendor/github.com/urfave/cli/v2/template.go | 2 +- .../urfave/cli/v2/zz_generated.flags.go | 16 ++++ vendor/modules.txt | 3 +- 30 files changed, 329 insertions(+), 215 deletions(-) delete mode 100644 vendor/github.com/andreazorzetto/yh/.gitignore delete mode 100644 vendor/github.com/andreazorzetto/yh/README.md delete mode 100644 vendor/github.com/andreazorzetto/yh/main.go delete mode 100644 vendor/github.com/urfave/cli/v2/sliceflag_pre18.go diff --git a/go.mod b/go.mod index 03d49f8..55537f0 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/andreazorzetto/yh v0.4.0 github.com/pkg/errors v0.9.1 github.com/schollz/closestmatch v2.1.0+incompatible - github.com/urfave/cli/v2 v2.23.7 + github.com/urfave/cli/v2 v2.25.5 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 1e46034..993fdf3 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/urfave/cli/v2 v2.23.7 h1:YHDQ46s3VghFHFf1DdF+Sh7H4RqhcM+t0TmZRJx4oJY= -github.com/urfave/cli/v2 v2.23.7/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/urfave/cli/v2 v2.25.5 h1:d0NIAyhh5shGscroL7ek/Ya9QYQE0KNabJgiUinIQkc= +github.com/urfave/cli/v2 v2.25.5/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= diff --git a/vendor/github.com/andreazorzetto/yh/.gitignore b/vendor/github.com/andreazorzetto/yh/.gitignore deleted file mode 100644 index 562d4f6..0000000 --- a/vendor/github.com/andreazorzetto/yh/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.idea -.DS_Store -*.zip -main \ No newline at end of file diff --git a/vendor/github.com/andreazorzetto/yh/README.md b/vendor/github.com/andreazorzetto/yh/README.md deleted file mode 100644 index 4210bca..0000000 --- a/vendor/github.com/andreazorzetto/yh/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# yh - YAML Highlighter - -A dummy syntax highlighter that brings colours to YAML output, jq style. - -This project starts with the author's incapacity to give up on colours while playing with kubernetes cli and YAML output (`kubectl get something -o yaml`). - -Unable to find another YAML highlighter where he could simply dump something on, with little to no ~~respect~~ expectations, and inspired by the recent Go training, he decided to write one from scratch. - -![Comparison with or without yh](https://raw.githubusercontent.com/andreazorzetto/yh/master/images/comparison.png) - -# How to use - -As **easy** as you secretly hoped - -`kubectl get pod alpine -o yaml | yh` - -Other commands: - -- `yh help` -- `yh version` - -# Download & installation - -Find the latest releases here: - -- [Releases](https://github.com/andreazorzetto/yh/releases) - -**Linux or MacOS** - -Unzip - -`unzip yh--.zip` - -Move the binary somewhere in your PATH - -`mv yh /usr/local/bin/` - -**Windows** - -Like above but with your mouse - -# Future developments - -The aim of this project is to be a simple highlighting tool, while there are more featured projects our there to do YAML parsing. However I intend to keep maintaining the code and introduce new features and/or explore different routes in the future. Anyone thinking to contribute or make suggestions/requests would be more than welcome. diff --git a/vendor/github.com/andreazorzetto/yh/main.go b/vendor/github.com/andreazorzetto/yh/main.go deleted file mode 100644 index bf50ac9..0000000 --- a/vendor/github.com/andreazorzetto/yh/main.go +++ /dev/null @@ -1,53 +0,0 @@ -package main - -import ( - "fmt" - "log" - "os" - - "github.com/andreazorzetto/yh/highlight" -) - -const version = "0.4.0" - -func main() { - log.SetFlags(0) // disable timestamp of log package - - // Checking the args, someone out there might need help - checkArgs(os.Args) - - h, err := highlight.Highlight(os.Stdin) - if err != nil { - log.Fatalln(err) - } - - fmt.Print(h) -} - -// Check args if passed -// Show help -func checkArgs(a []string) { - if len(a) >= 2 { - // Someone's looking for... - - if a[1] == "version" { - // version - fmt.Println(version) - os.Exit(0) - - } else if a[1] == "help" { - // help - fmt.Println("You don't really need to read this! \nJust pipe me some YAML. I don't bite") - fmt.Println("\nExample:") - fmt.Println("\tkubectl get myNastyPod -o yaml | yh") - fmt.Println("\nCommands:") - fmt.Println("\thelp: get this helpful help") - fmt.Println("\tversion: get the version") - os.Exit(0) - } else { - // trolling - fmt.Println("Not really sure of what you want! Maybe try help or version.") - os.Exit(0) - } - } -} diff --git a/vendor/github.com/urfave/cli/v2/README.md b/vendor/github.com/urfave/cli/v2/README.md index eaed356..9080aee 100644 --- a/vendor/github.com/urfave/cli/v2/README.md +++ b/vendor/github.com/urfave/cli/v2/README.md @@ -1,9 +1,9 @@ # cli -[![GoDoc](https://godoc.org/github.com/urfave/cli?status.svg)](https://pkg.go.dev/github.com/urfave/cli/v2) -[![codebeat](https://codebeat.co/badges/0a8f30aa-f975-404b-b878-5fab3ae1cc5f)](https://codebeat.co/projects/github-com-urfave-cli) -[![Go Report Card](https://goreportcard.com/badge/urfave/cli)](https://goreportcard.com/report/urfave/cli) -[![codecov](https://codecov.io/gh/urfave/cli/branch/main/graph/badge.svg)](https://codecov.io/gh/urfave/cli) +[![Run Tests](https://github.com/urfave/cli/actions/workflows/cli.yml/badge.svg?branch=v2-maint)](https://github.com/urfave/cli/actions/workflows/cli.yml) +[![Go Reference](https://pkg.go.dev/badge/github.com/urfave/cli/v2.svg)](https://pkg.go.dev/github.com/urfave/cli/v2) +[![Go Report Card](https://goreportcard.com/badge/github.com/urfave/cli/v2)](https://goreportcard.com/report/github.com/urfave/cli/v2) +[![codecov](https://codecov.io/gh/urfave/cli/branch/v2-maint/graph/badge.svg?token=t9YGWLh05g)](https://app.codecov.io/gh/urfave/cli/tree/v2-maint) cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable command line diff --git a/vendor/github.com/urfave/cli/v2/app.go b/vendor/github.com/urfave/cli/v2/app.go index 10198f4..19b76c9 100644 --- a/vendor/github.com/urfave/cli/v2/app.go +++ b/vendor/github.com/urfave/cli/v2/app.go @@ -121,7 +121,8 @@ type App struct { // Treat all flags as normal arguments if true SkipFlagParsing bool - didSetup bool + didSetup bool + separator separatorSpec rootCommand *Command } @@ -216,6 +217,16 @@ func (a *App) Setup() { }) } + if len(a.SliceFlagSeparator) != 0 { + a.separator.customized = true + a.separator.sep = a.SliceFlagSeparator + } + + if a.DisableSliceFlagSeparator { + a.separator.customized = true + a.separator.disabled = true + } + var newCommands []*Command for _, c := range a.Commands { @@ -223,8 +234,8 @@ func (a *App) Setup() { if c.HelpName != "" { cname = c.HelpName } + c.separator = a.separator c.HelpName = fmt.Sprintf("%s %s", a.HelpName, cname) - c.flagCategories = newFlagCategoriesFromFlags(c.Flags) newCommands = append(newCommands, c) } @@ -250,24 +261,11 @@ func (a *App) Setup() { } sort.Sort(a.categories.(*commandCategories)) - a.flagCategories = newFlagCategories() - for _, fl := range a.Flags { - if cf, ok := fl.(CategorizableFlag); ok { - if cf.GetCategory() != "" { - a.flagCategories.AddFlag(cf.GetCategory(), cf) - } - } - } + a.flagCategories = newFlagCategoriesFromFlags(a.Flags) if a.Metadata == nil { a.Metadata = make(map[string]interface{}) } - - if len(a.SliceFlagSeparator) != 0 { - defaultSliceFlagSeparator = a.SliceFlagSeparator - } - - disableSliceFlagSeparator = a.DisableSliceFlagSeparator } func (a *App) newRootCommand() *Command { @@ -293,11 +291,12 @@ func (a *App) newRootCommand() *Command { categories: a.categories, SkipFlagParsing: a.SkipFlagParsing, isRoot: true, + separator: a.separator, } } func (a *App) newFlagSet() (*flag.FlagSet, error) { - return flagSet(a.Name, a.Flags) + return flagSet(a.Name, a.Flags, a.separator) } func (a *App) useShortOptionHandling() bool { @@ -333,11 +332,18 @@ func (a *App) RunContext(ctx context.Context, arguments []string) (err error) { return a.rootCommand.Run(cCtx, arguments...) } -// This is a stub function to keep public API unchanged from old code -// -// Deprecated: use App.Run or App.RunContext +// RunAsSubcommand is for legacy/compatibility purposes only. New code should only +// use App.RunContext. This function is slated to be removed in v3. func (a *App) RunAsSubcommand(ctx *Context) (err error) { - return a.RunContext(ctx.Context, ctx.Args().Slice()) + a.Setup() + + cCtx := NewContext(a, nil, ctx) + cCtx.shellComplete = ctx.shellComplete + + a.rootCommand = a.newRootCommand() + cCtx.Command = a.rootCommand + + return a.rootCommand.Run(cCtx, ctx.Args().Slice()...) } func (a *App) suggestFlagFromError(err error, command string) (string, error) { diff --git a/vendor/github.com/urfave/cli/v2/category.go b/vendor/github.com/urfave/cli/v2/category.go index 7aca0c7..ccc043c 100644 --- a/vendor/github.com/urfave/cli/v2/category.go +++ b/vendor/github.com/urfave/cli/v2/category.go @@ -100,10 +100,23 @@ func newFlagCategories() FlagCategories { func newFlagCategoriesFromFlags(fs []Flag) FlagCategories { fc := newFlagCategories() + + var categorized bool for _, fl := range fs { if cf, ok := fl.(CategorizableFlag); ok { - if cf.GetCategory() != "" { - fc.AddFlag(cf.GetCategory(), cf) + if cat := cf.GetCategory(); cat != "" { + fc.AddFlag(cat, cf) + categorized = true + } + } + } + + if categorized == true { + for _, fl := range fs { + if cf, ok := fl.(CategorizableFlag); ok { + if cf.GetCategory() == "" { + fc.AddFlag("", fl) + } } } } diff --git a/vendor/github.com/urfave/cli/v2/command.go b/vendor/github.com/urfave/cli/v2/command.go index da9cf53..69a0fdf 100644 --- a/vendor/github.com/urfave/cli/v2/command.go +++ b/vendor/github.com/urfave/cli/v2/command.go @@ -69,6 +69,8 @@ type Command struct { // if this is a root "special" command isRoot bool + + separator separatorSpec } type Commands []*Command @@ -133,6 +135,7 @@ func (c *Command) setup(ctx *Context) { if scmd.HelpName == "" { scmd.HelpName = fmt.Sprintf("%s %s", c.HelpName, scmd.Name) } + scmd.separator = c.separator newCmds = append(newCmds, scmd) } c.Subcommands = newCmds @@ -275,7 +278,7 @@ func (c *Command) Run(cCtx *Context, arguments ...string) (err error) { } func (c *Command) newFlagSet() (*flag.FlagSet, error) { - return flagSet(c.Name, c.Flags) + return flagSet(c.Name, c.Flags, c.separator) } func (c *Command) useShortOptionHandling() bool { diff --git a/vendor/github.com/urfave/cli/v2/context.go b/vendor/github.com/urfave/cli/v2/context.go index dbf50e4..a45c120 100644 --- a/vendor/github.com/urfave/cli/v2/context.go +++ b/vendor/github.com/urfave/cli/v2/context.go @@ -56,6 +56,7 @@ func (cCtx *Context) Set(name, value string) error { // IsSet determines if the flag was actually set func (cCtx *Context) IsSet(name string) bool { + if fs := cCtx.lookupFlagSet(name); fs != nil { isSet := false fs.Visit(func(f *flag.Flag) { @@ -72,7 +73,23 @@ func (cCtx *Context) IsSet(name string) bool { return false } - return f.IsSet() + if f.IsSet() { + return true + } + + // now redo flagset search on aliases + aliases := f.Names() + fs.Visit(func(f *flag.Flag) { + for _, alias := range aliases { + if f.Name == alias { + isSet = true + } + } + }) + + if isSet { + return true + } } return false @@ -204,9 +221,10 @@ func (cCtx *Context) checkRequiredFlags(flags []Flag) requiredFlagsErr { var flagPresent bool var flagName string - for _, key := range f.Names() { - flagName = key + flagNames := f.Names() + flagName = flagNames[0] + for _, key := range flagNames { if cCtx.IsSet(strings.TrimSpace(key)) { flagPresent = true } diff --git a/vendor/github.com/urfave/cli/v2/docs.go b/vendor/github.com/urfave/cli/v2/docs.go index 8b1c9c8..6cd0624 100644 --- a/vendor/github.com/urfave/cli/v2/docs.go +++ b/vendor/github.com/urfave/cli/v2/docs.go @@ -153,9 +153,14 @@ func prepareFlags( // flagDetails returns a string containing the flags metadata func flagDetails(flag DocGenerationFlag) string { description := flag.GetUsage() - value := flag.GetValue() - if value != "" { - description += " (default: " + value + ")" + if flag.TakesValue() { + defaultText := flag.GetDefaultText() + if defaultText == "" { + defaultText = flag.GetValue() + } + if defaultText != "" { + description += " (default: " + defaultText + ")" + } } return ": " + description } diff --git a/vendor/github.com/urfave/cli/v2/flag-spec.yaml b/vendor/github.com/urfave/cli/v2/flag-spec.yaml index 76480ba..03d82e7 100644 --- a/vendor/github.com/urfave/cli/v2/flag-spec.yaml +++ b/vendor/github.com/urfave/cli/v2/flag-spec.yaml @@ -7,6 +7,8 @@ flag_types: - name: Count type: int pointer: true + - name: DisableDefaultText + type: bool - name: Action type: "func(*Context, bool) error" float64: @@ -18,6 +20,8 @@ flag_types: skip_interfaces: - fmt.Stringer struct_fields: + - name: separator + type: separatorSpec - name: Action type: "func(*Context, []float64) error" int: @@ -31,6 +35,8 @@ flag_types: skip_interfaces: - fmt.Stringer struct_fields: + - name: separator + type: separatorSpec - name: Action type: "func(*Context, []int) error" int64: @@ -44,6 +50,8 @@ flag_types: skip_interfaces: - fmt.Stringer struct_fields: + - name: separator + type: separatorSpec - name: Action type: "func(*Context, []int64) error" uint: @@ -57,6 +65,8 @@ flag_types: skip_interfaces: - fmt.Stringer struct_fields: + - name: separator + type: separatorSpec - name: Action type: "func(*Context, []uint) error" uint64: @@ -70,6 +80,8 @@ flag_types: skip_interfaces: - fmt.Stringer struct_fields: + - name: separator + type: separatorSpec - name: Action type: "func(*Context, []uint64) error" string: @@ -83,10 +95,14 @@ flag_types: skip_interfaces: - fmt.Stringer struct_fields: + - name: separator + type: separatorSpec - name: TakesFile type: bool - name: Action type: "func(*Context, []string) error" + - name: KeepSpace + type: bool time.Duration: struct_fields: - name: Action diff --git a/vendor/github.com/urfave/cli/v2/flag.go b/vendor/github.com/urfave/cli/v2/flag.go index 5c0a8b7..4d04de3 100644 --- a/vendor/github.com/urfave/cli/v2/flag.go +++ b/vendor/github.com/urfave/cli/v2/flag.go @@ -4,7 +4,7 @@ import ( "errors" "flag" "fmt" - "io/ioutil" + "io" "os" "regexp" "runtime" @@ -15,7 +15,7 @@ import ( const defaultPlaceholder = "value" -var ( +const ( defaultSliceFlagSeparator = "," disableSliceFlagSeparator = false ) @@ -34,18 +34,20 @@ var BashCompletionFlag Flag = &BoolFlag{ // VersionFlag prints the version for the application var VersionFlag Flag = &BoolFlag{ - Name: "version", - Aliases: []string{"v"}, - Usage: "print the version", + Name: "version", + Aliases: []string{"v"}, + Usage: "print the version", + DisableDefaultText: true, } // HelpFlag prints the help for all commands and subcommands. // Set to nil to disable the flag. The subcommand // will still be added unless HideHelp or HideHelpCommand is set to true. var HelpFlag Flag = &BoolFlag{ - Name: "help", - Aliases: []string{"h"}, - Usage: "show help", + Name: "help", + Aliases: []string{"h"}, + Usage: "show help", + DisableDefaultText: true, } // FlagStringer converts a flag definition to a string. This is used by help @@ -165,15 +167,18 @@ type Countable interface { Count() int } -func flagSet(name string, flags []Flag) (*flag.FlagSet, error) { +func flagSet(name string, flags []Flag, spec separatorSpec) (*flag.FlagSet, error) { set := flag.NewFlagSet(name, flag.ContinueOnError) for _, f := range flags { + if c, ok := f.(customizedSeparator); ok { + c.WithSeparatorSpec(spec) + } if err := f.Apply(set); err != nil { return nil, err } } - set.SetOutput(ioutil.Discard) + set.SetOutput(io.Discard) return set, nil } @@ -337,8 +342,13 @@ func stringifyFlag(f Flag) string { defaultValueString := "" - if s := df.GetDefaultText(); s != "" { - defaultValueString = fmt.Sprintf(formatDefault("%s"), s) + // set default text for all flags except bool flags + // for bool flags display default text if DisableDefaultText is not + // set + if bf, ok := f.(*BoolFlag); !ok || !bf.DisableDefaultText { + if s := df.GetDefaultText(); s != "" { + defaultValueString = fmt.Sprintf(formatDefault("%s"), s) + } } usageWithDefault := strings.TrimSpace(usage + defaultValueString) @@ -374,7 +384,7 @@ func flagFromEnvOrFile(envVars []string, filePath string) (value string, fromWhe } for _, fileVar := range strings.Split(filePath, ",") { if fileVar != "" { - if data, err := ioutil.ReadFile(fileVar); err == nil { + if data, err := os.ReadFile(fileVar); err == nil { return string(data), fmt.Sprintf("file %q", filePath), true } } @@ -382,10 +392,28 @@ func flagFromEnvOrFile(envVars []string, filePath string) (value string, fromWhe return "", "", false } -func flagSplitMultiValues(val string) []string { - if disableSliceFlagSeparator { +type customizedSeparator interface { + WithSeparatorSpec(separatorSpec) +} + +type separatorSpec struct { + sep string + disabled bool + customized bool +} + +func (s separatorSpec) flagSplitMultiValues(val string) []string { + var ( + disabled bool = s.disabled + sep string = s.sep + ) + if !s.customized { + disabled = disableSliceFlagSeparator + sep = defaultSliceFlagSeparator + } + if disabled { return []string{val} } - return strings.Split(val, defaultSliceFlagSeparator) + return strings.Split(val, sep) } diff --git a/vendor/github.com/urfave/cli/v2/flag_bool.go b/vendor/github.com/urfave/cli/v2/flag_bool.go index f64d1cd..369d18b 100644 --- a/vendor/github.com/urfave/cli/v2/flag_bool.go +++ b/vendor/github.com/urfave/cli/v2/flag_bool.go @@ -52,7 +52,7 @@ func (b *boolValue) String() string { func (b *boolValue) IsBoolFlag() bool { return true } func (b *boolValue) Count() int { - if b.count != nil { + if b.count != nil && *b.count > 0 { return *b.count } return 0 @@ -130,6 +130,11 @@ func (f *BoolFlag) Apply(set *flag.FlagSet) error { if count == nil { count = new(int) } + + // since count will be incremented for each alias as well + // subtract number of aliases from overall count + *count -= len(f.Aliases) + if dest == nil { dest = new(bool) } diff --git a/vendor/github.com/urfave/cli/v2/flag_float64_slice.go b/vendor/github.com/urfave/cli/v2/flag_float64_slice.go index 413aa50..0bc4612 100644 --- a/vendor/github.com/urfave/cli/v2/flag_float64_slice.go +++ b/vendor/github.com/urfave/cli/v2/flag_float64_slice.go @@ -11,6 +11,7 @@ import ( // Float64Slice wraps []float64 to satisfy flag.Value type Float64Slice struct { slice []float64 + separator separatorSpec hasBeenSet bool } @@ -29,6 +30,10 @@ func (f *Float64Slice) clone() *Float64Slice { return n } +func (f *Float64Slice) WithSeparatorSpec(spec separatorSpec) { + f.separator = spec +} + // Set parses the value into a float64 and appends it to the list of values func (f *Float64Slice) Set(value string) error { if !f.hasBeenSet { @@ -43,7 +48,7 @@ func (f *Float64Slice) Set(value string) error { return nil } - for _, s := range flagSplitMultiValues(value) { + for _, s := range f.separator.flagSplitMultiValues(value) { tmp, err := strconv.ParseFloat(strings.TrimSpace(s), 64) if err != nil { return err @@ -148,11 +153,12 @@ func (f *Float64SliceFlag) Apply(set *flag.FlagSet) error { setValue = f.Value.clone() default: setValue = new(Float64Slice) + setValue.WithSeparatorSpec(f.separator) } if val, source, found := flagFromEnvOrFile(f.EnvVars, f.FilePath); found { if val != "" { - for _, s := range flagSplitMultiValues(val) { + for _, s := range f.separator.flagSplitMultiValues(val) { if err := setValue.Set(strings.TrimSpace(s)); err != nil { return fmt.Errorf("could not parse %q as float64 slice value from %s for flag %s: %s", val, source, f.Name, err) } @@ -172,6 +178,10 @@ func (f *Float64SliceFlag) Apply(set *flag.FlagSet) error { return nil } +func (f *Float64SliceFlag) WithSeparatorSpec(spec separatorSpec) { + f.separator = spec +} + // Get returns the flag’s value in the given Context. func (f *Float64SliceFlag) Get(ctx *Context) []float64 { return ctx.Float64Slice(f.Name) diff --git a/vendor/github.com/urfave/cli/v2/flag_generic.go b/vendor/github.com/urfave/cli/v2/flag_generic.go index 4f9ac0a..039ffdf 100644 --- a/vendor/github.com/urfave/cli/v2/flag_generic.go +++ b/vendor/github.com/urfave/cli/v2/flag_generic.go @@ -117,13 +117,8 @@ func (cCtx *Context) Generic(name string) interface{} { } func lookupGeneric(name string, set *flag.FlagSet) interface{} { - f := set.Lookup(name) - if f != nil { - parsed, err := f.Value, error(nil) - if err != nil { - return nil - } - return parsed + if f := set.Lookup(name); f != nil { + return f.Value } return nil } diff --git a/vendor/github.com/urfave/cli/v2/flag_int64_slice.go b/vendor/github.com/urfave/cli/v2/flag_int64_slice.go index c45c43d..d45c2dd 100644 --- a/vendor/github.com/urfave/cli/v2/flag_int64_slice.go +++ b/vendor/github.com/urfave/cli/v2/flag_int64_slice.go @@ -11,6 +11,7 @@ import ( // Int64Slice wraps []int64 to satisfy flag.Value type Int64Slice struct { slice []int64 + separator separatorSpec hasBeenSet bool } @@ -29,6 +30,10 @@ func (i *Int64Slice) clone() *Int64Slice { return n } +func (i *Int64Slice) WithSeparatorSpec(spec separatorSpec) { + i.separator = spec +} + // Set parses the value into an integer and appends it to the list of values func (i *Int64Slice) Set(value string) error { if !i.hasBeenSet { @@ -43,7 +48,7 @@ func (i *Int64Slice) Set(value string) error { return nil } - for _, s := range flagSplitMultiValues(value) { + for _, s := range i.separator.flagSplitMultiValues(value) { tmp, err := strconv.ParseInt(strings.TrimSpace(s), 0, 64) if err != nil { return err @@ -149,10 +154,11 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error { setValue = f.Value.clone() default: setValue = new(Int64Slice) + setValue.WithSeparatorSpec(f.separator) } if val, source, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok && val != "" { - for _, s := range flagSplitMultiValues(val) { + for _, s := range f.separator.flagSplitMultiValues(val) { if err := setValue.Set(strings.TrimSpace(s)); err != nil { return fmt.Errorf("could not parse %q as int64 slice value from %s for flag %s: %s", val, source, f.Name, err) } @@ -171,6 +177,10 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error { return nil } +func (f *Int64SliceFlag) WithSeparatorSpec(spec separatorSpec) { + f.separator = spec +} + // Get returns the flag’s value in the given Context. func (f *Int64SliceFlag) Get(ctx *Context) []int64 { return ctx.Int64Slice(f.Name) diff --git a/vendor/github.com/urfave/cli/v2/flag_int_slice.go b/vendor/github.com/urfave/cli/v2/flag_int_slice.go index d4006e5..da9c09b 100644 --- a/vendor/github.com/urfave/cli/v2/flag_int_slice.go +++ b/vendor/github.com/urfave/cli/v2/flag_int_slice.go @@ -11,6 +11,7 @@ import ( // IntSlice wraps []int to satisfy flag.Value type IntSlice struct { slice []int + separator separatorSpec hasBeenSet bool } @@ -40,6 +41,10 @@ func (i *IntSlice) SetInt(value int) { i.slice = append(i.slice, value) } +func (i *IntSlice) WithSeparatorSpec(spec separatorSpec) { + i.separator = spec +} + // Set parses the value into an integer and appends it to the list of values func (i *IntSlice) Set(value string) error { if !i.hasBeenSet { @@ -54,7 +59,7 @@ func (i *IntSlice) Set(value string) error { return nil } - for _, s := range flagSplitMultiValues(value) { + for _, s := range i.separator.flagSplitMultiValues(value) { tmp, err := strconv.ParseInt(strings.TrimSpace(s), 0, 64) if err != nil { return err @@ -160,10 +165,11 @@ func (f *IntSliceFlag) Apply(set *flag.FlagSet) error { setValue = f.Value.clone() default: setValue = new(IntSlice) + setValue.WithSeparatorSpec(f.separator) } if val, source, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok && val != "" { - for _, s := range flagSplitMultiValues(val) { + for _, s := range f.separator.flagSplitMultiValues(val) { if err := setValue.Set(strings.TrimSpace(s)); err != nil { return fmt.Errorf("could not parse %q as int slice value from %s for flag %s: %s", val, source, f.Name, err) } @@ -182,6 +188,10 @@ func (f *IntSliceFlag) Apply(set *flag.FlagSet) error { return nil } +func (f *IntSliceFlag) WithSeparatorSpec(spec separatorSpec) { + f.separator = spec +} + // Get returns the flag’s value in the given Context. func (f *IntSliceFlag) Get(ctx *Context) []int { return ctx.IntSlice(f.Name) diff --git a/vendor/github.com/urfave/cli/v2/flag_path.go b/vendor/github.com/urfave/cli/v2/flag_path.go index 6434d32..c498677 100644 --- a/vendor/github.com/urfave/cli/v2/flag_path.go +++ b/vendor/github.com/urfave/cli/v2/flag_path.go @@ -90,13 +90,8 @@ func (cCtx *Context) Path(name string) string { } func lookupPath(name string, set *flag.FlagSet) string { - f := set.Lookup(name) - if f != nil { - parsed, err := f.Value.String(), error(nil) - if err != nil { - return "" - } - return parsed + if f := set.Lookup(name); f != nil { + return f.Value.String() } return "" } diff --git a/vendor/github.com/urfave/cli/v2/flag_string.go b/vendor/github.com/urfave/cli/v2/flag_string.go index 3050086..4e55a2c 100644 --- a/vendor/github.com/urfave/cli/v2/flag_string.go +++ b/vendor/github.com/urfave/cli/v2/flag_string.go @@ -87,10 +87,8 @@ func (cCtx *Context) String(name string) string { } func lookupString(name string, set *flag.FlagSet) string { - f := set.Lookup(name) - if f != nil { - parsed := f.Value.String() - return parsed + if f := set.Lookup(name); f != nil { + return f.Value.String() } return "" } diff --git a/vendor/github.com/urfave/cli/v2/flag_string_slice.go b/vendor/github.com/urfave/cli/v2/flag_string_slice.go index baca2a2..28f4798 100644 --- a/vendor/github.com/urfave/cli/v2/flag_string_slice.go +++ b/vendor/github.com/urfave/cli/v2/flag_string_slice.go @@ -11,7 +11,9 @@ import ( // StringSlice wraps a []string to satisfy flag.Value type StringSlice struct { slice []string + separator separatorSpec hasBeenSet bool + keepSpace bool } // NewStringSlice creates a *StringSlice with default values @@ -43,13 +45,20 @@ func (s *StringSlice) Set(value string) error { return nil } - for _, t := range flagSplitMultiValues(value) { - s.slice = append(s.slice, strings.TrimSpace(t)) + for _, t := range s.separator.flagSplitMultiValues(value) { + if !s.keepSpace { + t = strings.TrimSpace(t) + } + s.slice = append(s.slice, t) } return nil } +func (s *StringSlice) WithSeparatorSpec(spec separatorSpec) { + s.separator = spec +} + // String returns a readable representation of this value (for usage defaults) func (s *StringSlice) String() string { return fmt.Sprintf("%s", s.slice) @@ -141,11 +150,17 @@ func (f *StringSliceFlag) Apply(set *flag.FlagSet) error { setValue = f.Value.clone() default: setValue = new(StringSlice) + setValue.WithSeparatorSpec(f.separator) } + setValue.keepSpace = f.KeepSpace + if val, source, found := flagFromEnvOrFile(f.EnvVars, f.FilePath); found { - for _, s := range flagSplitMultiValues(val) { - if err := setValue.Set(strings.TrimSpace(s)); err != nil { + for _, s := range f.separator.flagSplitMultiValues(val) { + if !f.KeepSpace { + s = strings.TrimSpace(s) + } + if err := setValue.Set(s); err != nil { return fmt.Errorf("could not parse %q as string value from %s for flag %s: %s", val, source, f.Name, err) } } @@ -163,6 +178,10 @@ func (f *StringSliceFlag) Apply(set *flag.FlagSet) error { return nil } +func (f *StringSliceFlag) WithSeparatorSpec(spec separatorSpec) { + f.separator = spec +} + // Get returns the flag’s value in the given Context. func (f *StringSliceFlag) Get(ctx *Context) []string { return ctx.StringSlice(f.Name) diff --git a/vendor/github.com/urfave/cli/v2/flag_uint64_slice.go b/vendor/github.com/urfave/cli/v2/flag_uint64_slice.go index 61bb30b..e845dd5 100644 --- a/vendor/github.com/urfave/cli/v2/flag_uint64_slice.go +++ b/vendor/github.com/urfave/cli/v2/flag_uint64_slice.go @@ -11,6 +11,7 @@ import ( // Uint64Slice wraps []int64 to satisfy flag.Value type Uint64Slice struct { slice []uint64 + separator separatorSpec hasBeenSet bool } @@ -43,7 +44,7 @@ func (i *Uint64Slice) Set(value string) error { return nil } - for _, s := range flagSplitMultiValues(value) { + for _, s := range i.separator.flagSplitMultiValues(value) { tmp, err := strconv.ParseUint(strings.TrimSpace(s), 0, 64) if err != nil { return err @@ -55,6 +56,10 @@ func (i *Uint64Slice) Set(value string) error { return nil } +func (i *Uint64Slice) WithSeparatorSpec(spec separatorSpec) { + i.separator = spec +} + // String returns a readable representation of this value (for usage defaults) func (i *Uint64Slice) String() string { v := i.slice @@ -153,10 +158,11 @@ func (f *Uint64SliceFlag) Apply(set *flag.FlagSet) error { setValue = f.Value.clone() default: setValue = new(Uint64Slice) + setValue.WithSeparatorSpec(f.separator) } if val, source, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok && val != "" { - for _, s := range flagSplitMultiValues(val) { + for _, s := range f.separator.flagSplitMultiValues(val) { if err := setValue.Set(strings.TrimSpace(s)); err != nil { return fmt.Errorf("could not parse %q as uint64 slice value from %s for flag %s: %s", val, source, f.Name, err) } @@ -175,6 +181,10 @@ func (f *Uint64SliceFlag) Apply(set *flag.FlagSet) error { return nil } +func (f *Uint64SliceFlag) WithSeparatorSpec(spec separatorSpec) { + f.separator = spec +} + // Get returns the flag’s value in the given Context. func (f *Uint64SliceFlag) Get(ctx *Context) []uint64 { return ctx.Uint64Slice(f.Name) diff --git a/vendor/github.com/urfave/cli/v2/flag_uint_slice.go b/vendor/github.com/urfave/cli/v2/flag_uint_slice.go index 363aa65..d2aed48 100644 --- a/vendor/github.com/urfave/cli/v2/flag_uint_slice.go +++ b/vendor/github.com/urfave/cli/v2/flag_uint_slice.go @@ -11,6 +11,7 @@ import ( // UintSlice wraps []int to satisfy flag.Value type UintSlice struct { slice []uint + separator separatorSpec hasBeenSet bool } @@ -54,7 +55,7 @@ func (i *UintSlice) Set(value string) error { return nil } - for _, s := range flagSplitMultiValues(value) { + for _, s := range i.separator.flagSplitMultiValues(value) { tmp, err := strconv.ParseUint(strings.TrimSpace(s), 0, 32) if err != nil { return err @@ -66,6 +67,10 @@ func (i *UintSlice) Set(value string) error { return nil } +func (i *UintSlice) WithSeparatorSpec(spec separatorSpec) { + i.separator = spec +} + // String returns a readable representation of this value (for usage defaults) func (i *UintSlice) String() string { v := i.slice @@ -164,10 +169,11 @@ func (f *UintSliceFlag) Apply(set *flag.FlagSet) error { setValue = f.Value.clone() default: setValue = new(UintSlice) + setValue.WithSeparatorSpec(f.separator) } if val, source, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok && val != "" { - for _, s := range flagSplitMultiValues(val) { + for _, s := range f.separator.flagSplitMultiValues(val) { if err := setValue.Set(strings.TrimSpace(s)); err != nil { return fmt.Errorf("could not parse %q as uint slice value from %s for flag %s: %s", val, source, f.Name, err) } @@ -186,6 +192,10 @@ func (f *UintSliceFlag) Apply(set *flag.FlagSet) error { return nil } +func (f *UintSliceFlag) WithSeparatorSpec(spec separatorSpec) { + f.separator = spec +} + // Get returns the flag’s value in the given Context. func (f *UintSliceFlag) Get(ctx *Context) []uint { return ctx.UintSlice(f.Name) diff --git a/vendor/github.com/urfave/cli/v2/godoc-current.txt b/vendor/github.com/urfave/cli/v2/godoc-current.txt index 6afd244..6016bd8 100644 --- a/vendor/github.com/urfave/cli/v2/godoc-current.txt +++ b/vendor/github.com/urfave/cli/v2/godoc-current.txt @@ -141,7 +141,7 @@ USAGE: DESCRIPTION: {{template "descriptionTemplate" .}}{{end}}{{if .VisibleCommands}} -COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategories}} +COMMANDS:{{template "visibleCommandCategoryTemplate" .}}{{end}}{{if .VisibleFlagCategories}} OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} @@ -357,9 +357,8 @@ func (a *App) RunAndExitOnError() code in the cli.ExitCoder func (a *App) RunAsSubcommand(ctx *Context) (err error) - This is a stub function to keep public API unchanged from old code - - Deprecated: use App.Run or App.RunContext + RunAsSubcommand is for legacy/compatibility purposes only. New code should + only use App.RunContext. This function is slated to be removed in v3. func (a *App) RunContext(ctx context.Context, arguments []string) (err error) RunContext is like Run except it takes a Context that will be passed to @@ -455,6 +454,8 @@ type BoolFlag struct { Count *int + DisableDefaultText bool + Action func(*Context, bool) error // Has unexported fields. } @@ -881,18 +882,20 @@ var BashCompletionFlag Flag = &BoolFlag{ BashCompletionFlag enables bash-completion for all commands and subcommands var HelpFlag Flag = &BoolFlag{ - Name: "help", - Aliases: []string{"h"}, - Usage: "show help", + Name: "help", + Aliases: []string{"h"}, + Usage: "show help", + DisableDefaultText: true, } HelpFlag prints the help for all commands and subcommands. Set to nil to disable the flag. The subcommand will still be added unless HideHelp or HideHelpCommand is set to true. var VersionFlag Flag = &BoolFlag{ - Name: "version", - Aliases: []string{"v"}, - Usage: "print the version", + Name: "version", + Aliases: []string{"v"}, + Usage: "print the version", + DisableDefaultText: true, } VersionFlag prints the version for the application @@ -1034,6 +1037,8 @@ func (f *Float64Slice) String() string func (f *Float64Slice) Value() []float64 Value returns the slice of float64s set by this flag +func (f *Float64Slice) WithSeparatorSpec(spec separatorSpec) + type Float64SliceFlag struct { Name string @@ -1109,6 +1114,8 @@ func (f *Float64SliceFlag) String() string func (f *Float64SliceFlag) TakesValue() bool TakesValue returns true if the flag takes a value, otherwise false +func (f *Float64SliceFlag) WithSeparatorSpec(spec separatorSpec) + type Generic interface { Set(value string) error String() string @@ -1275,6 +1282,8 @@ func (i *Int64Slice) String() string func (i *Int64Slice) Value() []int64 Value returns the slice of ints set by this flag +func (i *Int64Slice) WithSeparatorSpec(spec separatorSpec) + type Int64SliceFlag struct { Name string @@ -1350,6 +1359,8 @@ func (f *Int64SliceFlag) String() string func (f *Int64SliceFlag) TakesValue() bool TakesValue returns true of the flag takes a value, otherwise false +func (f *Int64SliceFlag) WithSeparatorSpec(spec separatorSpec) + type IntFlag struct { Name string @@ -1445,6 +1456,8 @@ func (i *IntSlice) String() string func (i *IntSlice) Value() []int Value returns the slice of ints set by this flag +func (i *IntSlice) WithSeparatorSpec(spec separatorSpec) + type IntSliceFlag struct { Name string @@ -1520,6 +1533,8 @@ func (f *IntSliceFlag) String() string func (f *IntSliceFlag) TakesValue() bool TakesValue returns true of the flag takes a value, otherwise false +func (f *IntSliceFlag) WithSeparatorSpec(spec separatorSpec) + type InvalidFlagAccessFunc func(*Context, string) InvalidFlagAccessFunc is executed when an invalid flag is accessed from the context. @@ -1788,6 +1803,8 @@ func (s *StringSlice) String() string func (s *StringSlice) Value() []string Value returns the slice of strings set by this flag +func (s *StringSlice) WithSeparatorSpec(spec separatorSpec) + type StringSliceFlag struct { Name string @@ -1809,6 +1826,8 @@ type StringSliceFlag struct { TakesFile bool Action func(*Context, []string) error + + KeepSpace bool // Has unexported fields. } StringSliceFlag is a flag with type *StringSlice @@ -1865,6 +1884,8 @@ func (f *StringSliceFlag) String() string func (f *StringSliceFlag) TakesValue() bool TakesValue returns true of the flag takes a value, otherwise false +func (f *StringSliceFlag) WithSeparatorSpec(spec separatorSpec) + type SuggestCommandFunc func(commands []*Command, provided string) string type SuggestFlagFunc func(flags []Flag, provided string, hideHelp bool) string @@ -2059,6 +2080,8 @@ func (i *Uint64Slice) String() string func (i *Uint64Slice) Value() []uint64 Value returns the slice of ints set by this flag +func (i *Uint64Slice) WithSeparatorSpec(spec separatorSpec) + type Uint64SliceFlag struct { Name string @@ -2125,6 +2148,8 @@ func (f *Uint64SliceFlag) String() string func (f *Uint64SliceFlag) TakesValue() bool TakesValue returns true of the flag takes a value, otherwise false +func (f *Uint64SliceFlag) WithSeparatorSpec(spec separatorSpec) + type UintFlag struct { Name string @@ -2220,6 +2245,8 @@ func (i *UintSlice) String() string func (i *UintSlice) Value() []uint Value returns the slice of ints set by this flag +func (i *UintSlice) WithSeparatorSpec(spec separatorSpec) + type UintSliceFlag struct { Name string @@ -2286,6 +2313,8 @@ func (f *UintSliceFlag) String() string func (f *UintSliceFlag) TakesValue() bool TakesValue returns true of the flag takes a value, otherwise false +func (f *UintSliceFlag) WithSeparatorSpec(spec separatorSpec) + type VisibleFlag interface { Flag @@ -2413,6 +2442,9 @@ func (f *Float64SliceFlag) Apply(set *flag.FlagSet) error Apply saves the flagSet for later usage calls, then calls the wrapped Float64SliceFlag.Apply +func (f *Float64SliceFlag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSourceContext) error + ApplyInputSourceValue applies a Float64Slice value if required + type GenericFlag struct { *cli.GenericFlag // Has unexported fields. @@ -2434,12 +2466,16 @@ type InputSourceContext interface { Source() string Int(name string) (int, error) + Int64(name string) (int64, error) + Uint(name string) (uint, error) + Uint64(name string) (uint64, error) Duration(name string) (time.Duration, error) Float64(name string) (float64, error) String(name string) (string, error) StringSlice(name string) ([]string, error) IntSlice(name string) ([]int, error) Int64Slice(name string) ([]int64, error) + Float64Slice(name string) ([]float64, error) Generic(name string) (cli.Generic, error) Bool(name string) (bool, error) @@ -2483,6 +2519,8 @@ func (f *Int64Flag) Apply(set *flag.FlagSet) error Apply saves the flagSet for later usage calls, then calls the wrapped Int64Flag.Apply +func (f *Int64Flag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSourceContext) error + type Int64SliceFlag struct { *cli.Int64SliceFlag // Has unexported fields. @@ -2553,6 +2591,10 @@ func (fsm *MapInputSource) Duration(name string) (time.Duration, error) func (fsm *MapInputSource) Float64(name string) (float64, error) Float64 returns an float64 from the map if it exists otherwise returns 0 +func (fsm *MapInputSource) Float64Slice(name string) ([]float64, error) + Float64Slice returns an []float64 from the map if it exists otherwise + returns nil + func (fsm *MapInputSource) Generic(name string) (cli.Generic, error) Generic returns an cli.Generic from the map if it exists otherwise returns nil @@ -2560,6 +2602,9 @@ func (fsm *MapInputSource) Generic(name string) (cli.Generic, error) func (fsm *MapInputSource) Int(name string) (int, error) Int returns an int from the map if it exists otherwise returns 0 +func (fsm *MapInputSource) Int64(name string) (int64, error) + Int64 returns an int64 from the map if it exists otherwise returns 0 + func (fsm *MapInputSource) Int64Slice(name string) ([]int64, error) Int64Slice returns an []int64 from the map if it exists otherwise returns nil @@ -2578,6 +2623,12 @@ func (fsm *MapInputSource) StringSlice(name string) ([]string, error) StringSlice returns an []string from the map if it exists otherwise returns nil +func (fsm *MapInputSource) Uint(name string) (uint, error) + Int64 returns an int64 from the map if it exists otherwise returns 0 + +func (fsm *MapInputSource) Uint64(name string) (uint64, error) + UInt64 returns an uint64 from the map if it exists otherwise returns 0 + type PathFlag struct { *cli.PathFlag // Has unexported fields. @@ -2643,6 +2694,8 @@ func (f *Uint64Flag) Apply(set *flag.FlagSet) error Apply saves the flagSet for later usage calls, then calls the wrapped Uint64Flag.Apply +func (f *Uint64Flag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSourceContext) error + type UintFlag struct { *cli.UintFlag // Has unexported fields. @@ -2657,3 +2710,5 @@ func (f *UintFlag) Apply(set *flag.FlagSet) error Apply saves the flagSet for later usage calls, then calls the wrapped UintFlag.Apply +func (f *UintFlag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSourceContext) error + diff --git a/vendor/github.com/urfave/cli/v2/help.go b/vendor/github.com/urfave/cli/v2/help.go index c7b8f55..a71fceb 100644 --- a/vendor/github.com/urfave/cli/v2/help.go +++ b/vendor/github.com/urfave/cli/v2/help.go @@ -42,6 +42,7 @@ var helpCommand = &Command{ // 3 $ app foo // 4 $ app help foo // 5 $ app foo help + // 6 $ app foo -h (with no other sub-commands nor flags defined) // Case 4. when executing a help command set the context to parent // to allow resolution of subsequent args. This will transform @@ -77,6 +78,8 @@ var helpCommand = &Command{ HelpPrinter(cCtx.App.Writer, templ, cCtx.Command) return nil } + + // Case 6, handling incorporated in the callee itself return ShowSubcommandHelp(cCtx) }, } @@ -292,8 +295,12 @@ func ShowSubcommandHelp(cCtx *Context) error { if cCtx == nil { return nil } - - HelpPrinter(cCtx.App.Writer, SubcommandHelpTemplate, cCtx.Command) + // use custom template when provided (fixes #1703) + templ := SubcommandHelpTemplate + if cCtx.Command != nil && cCtx.Command.CustomHelpTemplate != "" { + templ = cCtx.Command.CustomHelpTemplate + } + HelpPrinter(cCtx.App.Writer, templ, cCtx.Command) return nil } diff --git a/vendor/github.com/urfave/cli/v2/sliceflag.go b/vendor/github.com/urfave/cli/v2/sliceflag.go index 7dea357..b2ca590 100644 --- a/vendor/github.com/urfave/cli/v2/sliceflag.go +++ b/vendor/github.com/urfave/cli/v2/sliceflag.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - package cli import ( diff --git a/vendor/github.com/urfave/cli/v2/sliceflag_pre18.go b/vendor/github.com/urfave/cli/v2/sliceflag_pre18.go deleted file mode 100644 index 1173ae7..0000000 --- a/vendor/github.com/urfave/cli/v2/sliceflag_pre18.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build !go1.18 -// +build !go1.18 - -package cli - -import ( - "flag" -) - -func unwrapFlagValue(v flag.Value) flag.Value { return v } diff --git a/vendor/github.com/urfave/cli/v2/template.go b/vendor/github.com/urfave/cli/v2/template.go index b565ba6..da98890 100644 --- a/vendor/github.com/urfave/cli/v2/template.go +++ b/vendor/github.com/urfave/cli/v2/template.go @@ -88,7 +88,7 @@ USAGE: DESCRIPTION: {{template "descriptionTemplate" .}}{{end}}{{if .VisibleCommands}} -COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategories}} +COMMANDS:{{template "visibleCommandCategoryTemplate" .}}{{end}}{{if .VisibleFlagCategories}} OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} diff --git a/vendor/github.com/urfave/cli/v2/zz_generated.flags.go b/vendor/github.com/urfave/cli/v2/zz_generated.flags.go index 7d0a267..73e7714 100644 --- a/vendor/github.com/urfave/cli/v2/zz_generated.flags.go +++ b/vendor/github.com/urfave/cli/v2/zz_generated.flags.go @@ -25,6 +25,8 @@ type Float64SliceFlag struct { defaultValue *Float64Slice + separator separatorSpec + Action func(*Context, []float64) error } @@ -120,6 +122,8 @@ type Int64SliceFlag struct { defaultValue *Int64Slice + separator separatorSpec + Action func(*Context, []int64) error } @@ -164,6 +168,8 @@ type IntSliceFlag struct { defaultValue *IntSlice + separator separatorSpec + Action func(*Context, []int) error } @@ -259,9 +265,13 @@ type StringSliceFlag struct { defaultValue *StringSlice + separator separatorSpec + TakesFile bool Action func(*Context, []string) error + + KeepSpace bool } // IsSet returns whether or not the flag has been set through env or file @@ -358,6 +368,8 @@ type Uint64SliceFlag struct { defaultValue *Uint64Slice + separator separatorSpec + Action func(*Context, []uint64) error } @@ -402,6 +414,8 @@ type UintSliceFlag struct { defaultValue *UintSlice + separator separatorSpec + Action func(*Context, []uint) error } @@ -448,6 +462,8 @@ type BoolFlag struct { Count *int + DisableDefaultText bool + Action func(*Context, bool) error } diff --git a/vendor/modules.txt b/vendor/modules.txt index 5202a19..11e3dda 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,7 +9,6 @@ github.com/Masterminds/semver/v3 github.com/Masterminds/sprig/v3 # github.com/andreazorzetto/yh v0.4.0 ## explicit; go 1.15 -github.com/andreazorzetto/yh github.com/andreazorzetto/yh/highlight # github.com/cpuguy83/go-md2man/v2 v2.0.2 ## explicit; go 1.11 @@ -47,7 +46,7 @@ github.com/shopspring/decimal # github.com/spf13/cast v1.3.1 ## explicit github.com/spf13/cast -# github.com/urfave/cli/v2 v2.23.7 +# github.com/urfave/cli/v2 v2.25.5 ## explicit; go 1.18 github.com/urfave/cli/v2 # github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673