update vendored libraries
This commit is contained in:
parent
174f0860a7
commit
cb5c7ea3f4
2
go.mod
2
go.mod
@ -2,7 +2,7 @@ module github.com/rocky-linux/rpaste
|
||||
|
||||
go 1.18
|
||||
|
||||
require github.com/urfave/cli/v2 v2.23.5
|
||||
require github.com/urfave/cli/v2 v2.25.1
|
||||
|
||||
require (
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
|
2
go.sum
2
go.sum
@ -4,5 +4,7 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/urfave/cli/v2 v2.23.5 h1:xbrU7tAYviSpqeR3X4nEFWUdB/uDZ6DE+HxmRU7Xtyw=
|
||||
github.com/urfave/cli/v2 v2.23.5/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
|
||||
github.com/urfave/cli/v2 v2.25.1 h1:zw8dSP7ghX0Gmm8vugrs6q9Ku0wzweqPyshy+syu9Gw=
|
||||
github.com/urfave/cli/v2 v2.25.1/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=
|
||||
|
@ -17,10 +17,10 @@ import (
|
||||
// Sane defaults and basic info
|
||||
var (
|
||||
AppName = "rpaste"
|
||||
Version = "0.3.0"
|
||||
Version = "0.3.1"
|
||||
DefaultConf = "/etc/rpaste/rpaste.conf"
|
||||
DefaultLexer = "text"
|
||||
DefaultLifeTime = "1hour"
|
||||
DefaultLifeTime = "1day"
|
||||
// This will end up being dynamic in the future
|
||||
DefaultPasteBin = "rpaste"
|
||||
DefaultSysInfo = false
|
||||
|
8
vendor/github.com/urfave/cli/v2/README.md
generated
vendored
8
vendor/github.com/urfave/cli/v2/README.md
generated
vendored
@ -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
|
||||
|
33
vendor/github.com/urfave/cli/v2/app.go
generated
vendored
33
vendor/github.com/urfave/cli/v2/app.go
generated
vendored
@ -107,6 +107,8 @@ type App struct {
|
||||
CustomAppHelpTemplate string
|
||||
// SliceFlagSeparator is used to customize the separator for SliceFlag, the default is ","
|
||||
SliceFlagSeparator string
|
||||
// DisableSliceFlagSeparator is used to disable SliceFlagSeparator, the default is false
|
||||
DisableSliceFlagSeparator bool
|
||||
// Boolean to enable short-option handling so user can combine several
|
||||
// single-character bool arguments into one
|
||||
// i.e. foobar -o -v -> foobar -ov
|
||||
@ -119,7 +121,8 @@ type App struct {
|
||||
// Treat all flags as normal arguments if true
|
||||
SkipFlagParsing bool
|
||||
|
||||
didSetup bool
|
||||
didSetup bool
|
||||
separator separatorSpec
|
||||
|
||||
rootCommand *Command
|
||||
}
|
||||
@ -214,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 {
|
||||
@ -221,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)
|
||||
}
|
||||
@ -248,22 +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
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) newRootCommand() *Command {
|
||||
@ -289,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 {
|
||||
|
17
vendor/github.com/urfave/cli/v2/category.go
generated
vendored
17
vendor/github.com/urfave/cli/v2/category.go
generated
vendored
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
vendor/github.com/urfave/cli/v2/command.go
generated
vendored
17
vendor/github.com/urfave/cli/v2/command.go
generated
vendored
@ -69,6 +69,8 @@ type Command struct {
|
||||
|
||||
// if this is a root "special" command
|
||||
isRoot bool
|
||||
|
||||
separator separatorSpec
|
||||
}
|
||||
|
||||
type Commands []*Command
|
||||
@ -133,9 +135,14 @@ 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
|
||||
|
||||
if c.BashComplete == nil {
|
||||
c.BashComplete = DefaultCompleteWithFlags(c)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) Run(cCtx *Context, arguments ...string) (err error) {
|
||||
@ -148,11 +155,7 @@ func (c *Command) Run(cCtx *Context, arguments ...string) (err error) {
|
||||
set, err := c.parseFlags(&a, cCtx.shellComplete)
|
||||
cCtx.flagSet = set
|
||||
|
||||
if c.isRoot {
|
||||
if checkCompletions(cCtx) {
|
||||
return nil
|
||||
}
|
||||
} else if checkCommandCompletions(cCtx, c.Name) {
|
||||
if checkCompletions(cCtx) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -203,7 +206,7 @@ func (c *Command) Run(cCtx *Context, arguments ...string) (err error) {
|
||||
|
||||
cerr := cCtx.checkRequiredFlags(c.Flags)
|
||||
if cerr != nil {
|
||||
_ = ShowSubcommandHelp(cCtx)
|
||||
_ = helpCommand.Action(cCtx)
|
||||
return cerr
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
16
vendor/github.com/urfave/cli/v2/flag-spec.yaml
generated
vendored
16
vendor/github.com/urfave/cli/v2/flag-spec.yaml
generated
vendored
@ -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
|
||||
|
65
vendor/github.com/urfave/cli/v2/flag.go
generated
vendored
65
vendor/github.com/urfave/cli/v2/flag.go
generated
vendored
@ -4,7 +4,7 @@ import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"regexp"
|
||||
"runtime"
|
||||
@ -15,7 +15,10 @@ import (
|
||||
|
||||
const defaultPlaceholder = "value"
|
||||
|
||||
var defaultSliceFlagSeparator = ","
|
||||
const (
|
||||
defaultSliceFlagSeparator = ","
|
||||
disableSliceFlagSeparator = false
|
||||
)
|
||||
|
||||
var (
|
||||
slPfx = fmt.Sprintf("sl:::%d:::", time.Now().UTC().UnixNano())
|
||||
@ -31,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
|
||||
@ -162,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
|
||||
}
|
||||
|
||||
@ -334,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)
|
||||
@ -371,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
|
||||
}
|
||||
}
|
||||
@ -379,6 +392,28 @@ func flagFromEnvOrFile(envVars []string, filePath string) (value string, fromWhe
|
||||
return "", "", false
|
||||
}
|
||||
|
||||
func flagSplitMultiValues(val string) []string {
|
||||
return strings.Split(val, defaultSliceFlagSeparator)
|
||||
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, sep)
|
||||
}
|
||||
|
14
vendor/github.com/urfave/cli/v2/flag_float64_slice.go
generated
vendored
14
vendor/github.com/urfave/cli/v2/flag_float64_slice.go
generated
vendored
@ -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)
|
||||
|
14
vendor/github.com/urfave/cli/v2/flag_int64_slice.go
generated
vendored
14
vendor/github.com/urfave/cli/v2/flag_int64_slice.go
generated
vendored
@ -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)
|
||||
|
14
vendor/github.com/urfave/cli/v2/flag_int_slice.go
generated
vendored
14
vendor/github.com/urfave/cli/v2/flag_int_slice.go
generated
vendored
@ -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)
|
||||
|
27
vendor/github.com/urfave/cli/v2/flag_string_slice.go
generated
vendored
27
vendor/github.com/urfave/cli/v2/flag_string_slice.go
generated
vendored
@ -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)
|
||||
|
14
vendor/github.com/urfave/cli/v2/flag_uint64_slice.go
generated
vendored
14
vendor/github.com/urfave/cli/v2/flag_uint64_slice.go
generated
vendored
@ -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)
|
||||
|
14
vendor/github.com/urfave/cli/v2/flag_uint_slice.go
generated
vendored
14
vendor/github.com/urfave/cli/v2/flag_uint_slice.go
generated
vendored
@ -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)
|
||||
|
70
vendor/github.com/urfave/cli/v2/godoc-current.txt
generated
vendored
70
vendor/github.com/urfave/cli/v2/godoc-current.txt
generated
vendored
@ -318,6 +318,8 @@ type App struct {
|
||||
CustomAppHelpTemplate string
|
||||
// SliceFlagSeparator is used to customize the separator for SliceFlag, the default is ","
|
||||
SliceFlagSeparator string
|
||||
// DisableSliceFlagSeparator is used to disable SliceFlagSeparator, the default is false
|
||||
DisableSliceFlagSeparator bool
|
||||
// Boolean to enable short-option handling so user can combine several
|
||||
// single-character bool arguments into one
|
||||
// i.e. foobar -o -v -> foobar -ov
|
||||
@ -453,6 +455,8 @@ type BoolFlag struct {
|
||||
|
||||
Count *int
|
||||
|
||||
DisableDefaultText bool
|
||||
|
||||
Action func(*Context, bool) error
|
||||
// Has unexported fields.
|
||||
}
|
||||
@ -879,18 +883,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
|
||||
|
||||
@ -1032,6 +1038,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
|
||||
|
||||
@ -1107,6 +1115,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
|
||||
@ -1273,6 +1283,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
|
||||
|
||||
@ -1348,6 +1360,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
|
||||
|
||||
@ -1443,6 +1457,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
|
||||
|
||||
@ -1518,6 +1534,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.
|
||||
@ -1786,6 +1804,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
|
||||
|
||||
@ -1807,6 +1827,8 @@ type StringSliceFlag struct {
|
||||
TakesFile bool
|
||||
|
||||
Action func(*Context, []string) error
|
||||
|
||||
KeepSpace bool
|
||||
// Has unexported fields.
|
||||
}
|
||||
StringSliceFlag is a flag with type *StringSlice
|
||||
@ -1863,6 +1885,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
|
||||
@ -2057,6 +2081,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
|
||||
|
||||
@ -2123,6 +2149,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
|
||||
|
||||
@ -2218,6 +2246,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
|
||||
|
||||
@ -2284,6 +2314,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
|
||||
|
||||
@ -2411,6 +2443,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.
|
||||
@ -2432,12 +2467,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)
|
||||
|
||||
@ -2481,6 +2520,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.
|
||||
@ -2551,6 +2592,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
|
||||
@ -2558,6 +2603,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
|
||||
@ -2576,6 +2624,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.
|
||||
@ -2641,6 +2695,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.
|
||||
@ -2655,3 +2711,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
|
||||
|
||||
|
21
vendor/github.com/urfave/cli/v2/help.go
generated
vendored
21
vendor/github.com/urfave/cli/v2/help.go
generated
vendored
@ -227,7 +227,7 @@ func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context) {
|
||||
return
|
||||
}
|
||||
|
||||
printCommandSuggestions(cCtx.App.Commands, cCtx.App.Writer)
|
||||
printCommandSuggestions(cCtx.Command.Subcommands, cCtx.App.Writer)
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,15 +308,15 @@ func printVersion(cCtx *Context) {
|
||||
|
||||
// ShowCompletions prints the lists of commands within a given context
|
||||
func ShowCompletions(cCtx *Context) {
|
||||
a := cCtx.App
|
||||
if a != nil && a.BashComplete != nil {
|
||||
a.BashComplete(cCtx)
|
||||
c := cCtx.Command
|
||||
if c != nil && c.BashComplete != nil {
|
||||
c.BashComplete(cCtx)
|
||||
}
|
||||
}
|
||||
|
||||
// ShowCommandCompletions prints the custom completions for a given command
|
||||
func ShowCommandCompletions(ctx *Context, command string) {
|
||||
c := ctx.App.Command(command)
|
||||
c := ctx.Command.Command(command)
|
||||
if c != nil {
|
||||
if c.BashComplete != nil {
|
||||
c.BashComplete(ctx)
|
||||
@ -453,7 +453,7 @@ func checkCompletions(cCtx *Context) bool {
|
||||
|
||||
if args := cCtx.Args(); args.Present() {
|
||||
name := args.First()
|
||||
if cmd := cCtx.App.Command(name); cmd != nil {
|
||||
if cmd := cCtx.Command.Command(name); cmd != nil {
|
||||
// let the command handle the completion
|
||||
return false
|
||||
}
|
||||
@ -463,15 +463,6 @@ func checkCompletions(cCtx *Context) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func checkCommandCompletions(c *Context, name string) bool {
|
||||
if !c.shellComplete {
|
||||
return false
|
||||
}
|
||||
|
||||
ShowCommandCompletions(c, name)
|
||||
return true
|
||||
}
|
||||
|
||||
func subtract(a, b int) int {
|
||||
return a - b
|
||||
}
|
||||
|
3
vendor/github.com/urfave/cli/v2/sliceflag.go
generated
vendored
3
vendor/github.com/urfave/cli/v2/sliceflag.go
generated
vendored
@ -1,6 +1,3 @@
|
||||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
|
10
vendor/github.com/urfave/cli/v2/sliceflag_pre18.go
generated
vendored
10
vendor/github.com/urfave/cli/v2/sliceflag_pre18.go
generated
vendored
@ -1,10 +0,0 @@
|
||||
//go:build !go1.18
|
||||
// +build !go1.18
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"flag"
|
||||
)
|
||||
|
||||
func unwrapFlagValue(v flag.Value) flag.Value { return v }
|
16
vendor/github.com/urfave/cli/v2/zz_generated.flags.go
generated
vendored
16
vendor/github.com/urfave/cli/v2/zz_generated.flags.go
generated
vendored
@ -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
|
||||
}
|
||||
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -4,7 +4,7 @@ github.com/cpuguy83/go-md2man/v2/md2man
|
||||
# github.com/russross/blackfriday/v2 v2.1.0
|
||||
## explicit
|
||||
github.com/russross/blackfriday/v2
|
||||
# github.com/urfave/cli/v2 v2.23.5
|
||||
# github.com/urfave/cli/v2 v2.25.1
|
||||
## explicit; go 1.18
|
||||
github.com/urfave/cli/v2
|
||||
# github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
|
||||
|
Loading…
Reference in New Issue
Block a user