Merge pull request #1569 from urfave/v3-porting

Porting `main` to `v3-dev-main` circa 2022-11-06
This commit is contained in:
Dan Buch 2022-11-08 12:51:58 -05:00 committed by GitHub
commit c296830b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 645 additions and 570 deletions

View File

@ -3,11 +3,14 @@ on:
push: push:
branches: branches:
- main - main
- v3-dev-main
tags: tags:
- v2.* - v2.*
- v3.*
pull_request: pull_request:
branches: branches:
- main - main
- v3-dev-main
permissions: permissions:
contents: read contents: read
jobs: jobs:
@ -15,7 +18,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
go: [1.17.x, 1.18.x, 1.19.x] go: [1.18.x, 1.19.x]
name: ${{ matrix.os }} @ Go ${{ matrix.go }} name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@ -43,13 +46,17 @@ jobs:
- if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest' - if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
run: make generate run: make generate
- run: make diffcheck - run: make diffcheck
- if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest' # TODO: switch once v3 is released {{
# - if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
- if: 'false'
run: make v2diff run: make v2diff
# }}
- if: success() && matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest' - if: success() && matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true fail_ci_if_error: true
test-docs: test-docs:
name: test-docs name: test-docs
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -66,12 +73,15 @@ jobs:
- run: make ensure-gfmrun - run: make ensure-gfmrun
- run: make gfmrun - run: make gfmrun
env: env:
FLAGS: --walk docs/v2/ FLAGS: --walk docs/v3/
- run: make diffcheck - run: make diffcheck
publish: publish:
permissions: permissions:
contents: write contents: write
if: startswith(github.ref, 'refs/tags/') # TODO: switch once v3 is released {{
# if: startswith(github.ref, 'refs/tags/')
if: 'false'
# }}
name: publish name: publish
needs: [test-docs] needs: [test-docs]
runs-on: ubuntu-latest runs-on: ubuntu-latest

3
.gitignore vendored
View File

@ -5,9 +5,8 @@
.envrc .envrc
.idea .idea
/.local/ /.local/
/cmd/urfave-cli-genflags/urfave-cli-genflags
/site/ /site/
coverage.txt coverage.txt
internal/*/built-example internal/*/built-example
vendor vendor
/cmd/urfave-cli-genflags/urfave-cli-genflags
*.exe

View File

@ -7,7 +7,7 @@
GO_RUN_BUILD := go run internal/build/build.go GO_RUN_BUILD := go run internal/build/build.go
.PHONY: all .PHONY: all
all: generate vet test check-binary-size gfmrun yamlfmt v2diff all: generate vet test check-binary-size gfmrun yamlfmt
# NOTE: this is a special catch-all rule to run any of the commands # NOTE: this is a special catch-all rule to run any of the commands
# defined in internal/build/build.go with optional arguments passed # defined in internal/build/build.go with optional arguments passed

View File

@ -1,6 +1,6 @@
# cli # cli
[![GoDoc](https://godoc.org/github.com/urfave/cli?status.svg)](https://pkg.go.dev/github.com/urfave/cli/v2) [![GoDoc](https://godoc.org/github.com/urfave/cli?status.svg)](https://pkg.go.dev/github.com/urfave/cli/v3)
[![codebeat](https://codebeat.co/badges/0a8f30aa-f975-404b-b878-5fab3ae1cc5f)](https://codebeat.co/projects/github-com-urfave-cli) [![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) [![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) [![codecov](https://codecov.io/gh/urfave/cli/branch/main/graph/badge.svg)](https://codecov.io/gh/urfave/cli)

View File

@ -6,7 +6,7 @@ import (
"strconv" "strconv"
"syscall" "syscall"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
// FlagInputSourceExtension is an extension interface of cli.Flag that // FlagInputSourceExtension is an extension interface of cli.Flag that

View File

@ -5,7 +5,7 @@ package altsrc
import ( import (
"flag" "flag"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
// BoolFlag is the flag type that wraps cli.BoolFlag to allow // BoolFlag is the flag type that wraps cli.BoolFlag to allow

View File

@ -10,7 +10,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
type testApplyInputSource struct { type testApplyInputSource struct {

View File

@ -3,7 +3,7 @@ package altsrc
import ( import (
"time" "time"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
// InputSourceContext is an interface used to allow // InputSourceContext is an interface used to allow

View File

@ -6,7 +6,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
const ( const (

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
// NewJSONSourceFromFlagFunc returns a func that takes a cli.Context // NewJSONSourceFromFlagFunc returns a func that takes a cli.Context

View File

@ -6,7 +6,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
// MapInputSource implements InputSourceContext to return // MapInputSource implements InputSourceContext to return

View File

@ -6,7 +6,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
func TestCommandTomFileTest(t *testing.T) { func TestCommandTomFileTest(t *testing.T) {

View File

@ -5,7 +5,7 @@ import (
"reflect" "reflect"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
type tomlMap struct { type tomlMap struct {

View File

@ -6,7 +6,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
func TestCommandYamlFileTest(t *testing.T) { func TestCommandYamlFileTest(t *testing.T) {

View File

@ -9,7 +9,7 @@ import (
"runtime" "runtime"
"strings" "strings"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )

View File

@ -6,8 +6,8 @@ import (
"os" "os"
"time" "time"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
"github.com/urfave/cli/v2/altsrc" "github.com/urfave/cli/v3/altsrc"
) )
func ExampleApp_Run_yamlFileLoaderDuration() { func ExampleApp_Run_yamlFileLoaderDuration() {

View File

@ -2486,6 +2486,26 @@ func (c *customBoolFlag) IsSet() bool {
return false return false
} }
func (c *customBoolFlag) IsRequired() bool {
return false
}
func (c *customBoolFlag) IsVisible() bool {
return false
}
func (c *customBoolFlag) GetCategory() string {
return ""
}
func (c *customBoolFlag) GetEnvVars() []string {
return nil
}
func (c *customBoolFlag) GetDefaultText() string {
return ""
}
func TestCustomFlagsUnused(t *testing.T) { func TestCustomFlagsUnused(t *testing.T) {
app := &App{ app := &App{
Flags: []Flag{&customBoolFlag{"custom"}}, Flags: []Flag{&customBoolFlag{"custom"}},

View File

@ -47,21 +47,38 @@ func (f *{{.TypeName}}) Names() []string {
return {{$.UrfaveCLINamespace}}FlagNames(f.Name, f.Aliases) return {{$.UrfaveCLINamespace}}FlagNames(f.Name, f.Aliases)
} }
{{end}}{{/* /if .GenerateFlagInterface */}}
{{if .GenerateRequiredFlagInterface}}
// IsRequired returns whether or not the flag is required // IsRequired returns whether or not the flag is required
func (f *{{.TypeName}}) IsRequired() bool { func (f *{{.TypeName}}) IsRequired() bool {
return f.Required return f.Required
} }
{{end}}{{/* /if .GenerateRequiredFlagInterface */}}
{{if .GenerateVisibleFlagInterface}}
// IsVisible returns true if the flag is not hidden, otherwise false // IsVisible returns true if the flag is not hidden, otherwise false
func (f *{{.TypeName}}) IsVisible() bool { func (f *{{.TypeName}}) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
{{end}}{{/* /if .GenerateVisibleFlagInterface */}}
// GetCategory returns the category of the flag
func (f *{{.TypeName}}) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *{{.TypeName}}) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *{{.TypeName}}) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *{{.TypeName}}) TakesValue() bool {
return "{{.TypeName }}" != "BoolFlag"
}
{{end}}{{/* /if .GenerateFlagInterface */}}
{{end}}{{/* /range .SortedFlagTypes */}} {{end}}{{/* /range .SortedFlagTypes */}}
// vim{{/* 👻 */}}:ro // vim{{/* 👻 */}}:ro

View File

@ -2,11 +2,6 @@
package {{.PackageName}} package {{.PackageName}}
import (
"flag"
"github.com/urfave/cli/v2"
)
{{range .SortedFlagTypes}} {{range .SortedFlagTypes}}
// {{.TypeName}} is the flag type that wraps cli.{{.TypeName}} to allow // {{.TypeName}} is the flag type that wraps cli.{{.TypeName}} to allow
// for other values to be specified // for other values to be specified

View File

@ -10,6 +10,19 @@ func Test{{.TypeName}}_SatisfiesFlagInterface(t *testing.T) {
_ = f.IsSet() _ = f.IsSet()
_ = f.Names() _ = f.Names()
} }
func Test{{.TypeName}}_SatisfiesRequiredFlagInterface(t *testing.T) {
var f {{$.UrfaveCLITestNamespace}}RequiredFlag = &{{$.UrfaveCLITestNamespace}}{{.TypeName}}{}
_ = f.IsRequired()
}
func Test{{.TypeName}}_SatisfiesVisibleFlagInterface(t *testing.T) {
var f {{$.UrfaveCLITestNamespace}}VisibleFlag = &{{$.UrfaveCLITestNamespace}}{{.TypeName}}{}
_ = f.IsVisible()
}
{{end}} {{end}}
{{if .GenerateFmtStringerInterface}} {{if .GenerateFmtStringerInterface}}
@ -20,21 +33,7 @@ func Test{{.TypeName}}_SatisfiesFmtStringerInterface(t *testing.T) {
} }
{{end}} {{end}}
{{if .GenerateRequiredFlagInterface}}
func Test{{.TypeName}}_SatisfiesRequiredFlagInterface(t *testing.T) {
var f {{$.UrfaveCLITestNamespace}}RequiredFlag = &{{$.UrfaveCLITestNamespace}}{{.TypeName}}{}
_ = f.IsRequired()
}
{{end}}
{{if .GenerateVisibleFlagInterface}}
func Test{{.TypeName}}_SatisfiesVisibleFlagInterface(t *testing.T) {
var f {{$.UrfaveCLITestNamespace}}VisibleFlag = &{{$.UrfaveCLITestNamespace}}{{.TypeName}}{}
_ = f.IsVisible()
}
{{end}}
{{end}} {{end}}
// vim{{/* 👻 */}}:ro // vim{{/* 👻 */}}:ro

View File

@ -240,7 +240,7 @@ For example this:
<!-- { <!-- {
"args": ["&#45;&#45;help"], "args": ["&#45;&#45;help"],
"output": ".*Load configuration from FILE\n.*Language for the greeting.*" "output": ".*Load configuration from FILE\n.*\n.*Language for the greeting.*"
} --> } -->
```go ```go
package main package main

1
docs/v3/index.md Normal file
View File

@ -0,0 +1 @@
# v3 guide

View File

@ -3,6 +3,7 @@
# `Spec` type that maps to this file structure. # `Spec` type that maps to this file structure.
flag_types: flag_types:
bool: bool:
no_default_text: true
struct_fields: struct_fields:
- name: Count - name: Count
type: int type: int

19
flag.go
View File

@ -97,9 +97,14 @@ type ActionableFlag interface {
// this interface be implemented. // this interface be implemented.
type Flag interface { type Flag interface {
fmt.Stringer fmt.Stringer
// Apply Flag settings to the given flag set // Apply Flag settings to the given flag set
Apply(*flag.FlagSet) error Apply(*flag.FlagSet) error
// All possible names for this flag
Names() []string Names() []string
// Whether the flag has been set or not
IsSet() bool IsSet() bool
} }
@ -108,6 +113,7 @@ type Flag interface {
type RequiredFlag interface { type RequiredFlag interface {
Flag Flag
// whether the flag is a required flag or not
IsRequired() bool IsRequired() bool
} }
@ -140,6 +146,12 @@ type DocGenerationSliceFlag interface {
IsSliceFlag() bool IsSliceFlag() bool
} }
// Countable is an interface to enable detection of flag values which support
// repetitive flags
type Countable interface {
Count() int
}
// VisibleFlag is an interface that allows to check if a flag is visible // VisibleFlag is an interface that allows to check if a flag is visible
type VisibleFlag interface { type VisibleFlag interface {
Flag Flag
@ -153,15 +165,10 @@ type VisibleFlag interface {
type CategorizableFlag interface { type CategorizableFlag interface {
VisibleFlag VisibleFlag
// Returns the category of the flag
GetCategory() string GetCategory() string
} }
// Countable is an interface to enable detection of flag values which support
// repetitive flags
type Countable interface {
Count() int
}
func flagSet(name string, flags []Flag) (*flag.FlagSet, error) { func flagSet(name string, flags []Flag) (*flag.FlagSet, error) {
set := flag.NewFlagSet(name, flag.ContinueOnError) set := flag.NewFlagSet(name, flag.ContinueOnError)

View File

@ -58,21 +58,6 @@ func (b *boolValue) Count() int {
return 0 return 0
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *BoolFlag) TakesValue() bool {
return false
}
// GetUsage returns the usage string for the flag
func (f *BoolFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *BoolFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *BoolFlag) GetValue() string { func (f *BoolFlag) GetValue() string {
@ -87,11 +72,6 @@ func (f *BoolFlag) GetDefaultText() string {
return fmt.Sprintf("%v", f.defaultValue) return fmt.Sprintf("%v", f.defaultValue)
} }
// GetEnvVars returns the env vars for this flag
func (f *BoolFlag) GetEnvVars() []string {
return f.EnvVars
}
// RunAction executes flag action if set // RunAction executes flag action if set
func (f *BoolFlag) RunAction(c *Context) error { func (f *BoolFlag) RunAction(c *Context) error {
if f.Action != nil { if f.Action != nil {

View File

@ -6,21 +6,6 @@ import (
"time" "time"
) )
// TakesValue returns true of the flag takes a value, otherwise false
func (f *DurationFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *DurationFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *DurationFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *DurationFlag) GetValue() string { func (f *DurationFlag) GetValue() string {
@ -35,11 +20,6 @@ func (f *DurationFlag) GetDefaultText() string {
return f.defaultValue.String() return f.defaultValue.String()
} }
// GetEnvVars returns the env vars for this flag
func (f *DurationFlag) GetEnvVars() []string {
return f.EnvVars
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *DurationFlag) Apply(set *flag.FlagSet) error { func (f *DurationFlag) Apply(set *flag.FlagSet) error {
// set default value so that environment wont be able to overwrite it // set default value so that environment wont be able to overwrite it

View File

@ -6,21 +6,6 @@ import (
"strconv" "strconv"
) )
// TakesValue returns true of the flag takes a value, otherwise false
func (f *Float64Flag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *Float64Flag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *Float64Flag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *Float64Flag) GetValue() string { func (f *Float64Flag) GetValue() string {
@ -35,11 +20,6 @@ func (f *Float64Flag) GetDefaultText() string {
return f.GetValue() return f.GetValue()
} }
// GetEnvVars returns the env vars for this flag
func (f *Float64Flag) GetEnvVars() []string {
return f.EnvVars
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *Float64Flag) Apply(set *flag.FlagSet) error { func (f *Float64Flag) Apply(set *flag.FlagSet) error {
if val, source, found := flagFromEnvOrFile(f.EnvVars, f.FilePath); found { if val, source, found := flagFromEnvOrFile(f.EnvVars, f.FilePath); found {

View File

@ -86,21 +86,6 @@ func (f *Float64SliceFlag) String() string {
return FlagStringer(f) return FlagStringer(f)
} }
// TakesValue returns true if the flag takes a value, otherwise false
func (f *Float64SliceFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *Float64SliceFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *Float64SliceFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *Float64SliceFlag) GetValue() string { func (f *Float64SliceFlag) GetValue() string {
@ -121,11 +106,6 @@ func (f *Float64SliceFlag) GetDefaultText() string {
return f.GetValue() return f.GetValue()
} }
// GetEnvVars returns the env vars for this flag
func (f *Float64SliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// IsSliceFlag implements DocGenerationSliceFlag. // IsSliceFlag implements DocGenerationSliceFlag.
func (f *Float64SliceFlag) IsSliceFlag() bool { func (f *Float64SliceFlag) IsSliceFlag() bool {
return true return true

View File

@ -24,21 +24,6 @@ func (s *stringGeneric) String() string {
return s.value return s.value
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *GenericFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *GenericFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *GenericFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *GenericFlag) GetValue() string { func (f *GenericFlag) GetValue() string {
@ -59,11 +44,6 @@ func (f *GenericFlag) GetDefaultText() string {
return "" return ""
} }
// GetEnvVars returns the env vars for this flag
func (f *GenericFlag) GetEnvVars() []string {
return f.EnvVars
}
// Apply takes the flagset and calls Set on the generic flag with the value // Apply takes the flagset and calls Set on the generic flag with the value
// provided by the user for parsing by the flag // provided by the user for parsing by the flag
func (f *GenericFlag) Apply(set *flag.FlagSet) error { func (f *GenericFlag) Apply(set *flag.FlagSet) error {

View File

@ -6,21 +6,6 @@ import (
"strconv" "strconv"
) )
// TakesValue returns true of the flag takes a value, otherwise false
func (f *IntFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *IntFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *IntFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *IntFlag) GetValue() string { func (f *IntFlag) GetValue() string {
@ -35,11 +20,6 @@ func (f *IntFlag) GetDefaultText() string {
return fmt.Sprintf("%d", f.defaultValue) return fmt.Sprintf("%d", f.defaultValue)
} }
// GetEnvVars returns the env vars for this flag
func (f *IntFlag) GetEnvVars() []string {
return f.EnvVars
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *IntFlag) Apply(set *flag.FlagSet) error { func (f *IntFlag) Apply(set *flag.FlagSet) error {
// set default value so that environment wont be able to overwrite it // set default value so that environment wont be able to overwrite it

View File

@ -6,21 +6,6 @@ import (
"strconv" "strconv"
) )
// TakesValue returns true of the flag takes a value, otherwise false
func (f *Int64Flag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *Int64Flag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *Int64Flag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *Int64Flag) GetValue() string { func (f *Int64Flag) GetValue() string {
@ -35,11 +20,6 @@ func (f *Int64Flag) GetDefaultText() string {
return fmt.Sprintf("%d", f.defaultValue) return fmt.Sprintf("%d", f.defaultValue)
} }
// GetEnvVars returns the env vars for this flag
func (f *Int64Flag) GetEnvVars() []string {
return f.EnvVars
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *Int64Flag) Apply(set *flag.FlagSet) error { func (f *Int64Flag) Apply(set *flag.FlagSet) error {
// set default value so that environment wont be able to overwrite it // set default value so that environment wont be able to overwrite it

View File

@ -87,21 +87,6 @@ func (f *Int64SliceFlag) String() string {
return FlagStringer(f) return FlagStringer(f)
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *Int64SliceFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *Int64SliceFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *Int64SliceFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *Int64SliceFlag) GetValue() string { func (f *Int64SliceFlag) GetValue() string {
@ -122,11 +107,6 @@ func (f *Int64SliceFlag) GetDefaultText() string {
return f.GetValue() return f.GetValue()
} }
// GetEnvVars returns the env vars for this flag
func (f *Int64SliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// IsSliceFlag implements DocGenerationSliceFlag. // IsSliceFlag implements DocGenerationSliceFlag.
func (f *Int64SliceFlag) IsSliceFlag() bool { func (f *Int64SliceFlag) IsSliceFlag() bool {
return true return true

View File

@ -98,21 +98,6 @@ func (f *IntSliceFlag) String() string {
return FlagStringer(f) return FlagStringer(f)
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *IntSliceFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *IntSliceFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *IntSliceFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *IntSliceFlag) GetValue() string { func (f *IntSliceFlag) GetValue() string {
@ -133,11 +118,6 @@ func (f *IntSliceFlag) GetDefaultText() string {
return f.GetValue() return f.GetValue()
} }
// GetEnvVars returns the env vars for this flag
func (f *IntSliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// IsSliceFlag implements DocGenerationSliceFlag. // IsSliceFlag implements DocGenerationSliceFlag.
func (f *IntSliceFlag) IsSliceFlag() bool { func (f *IntSliceFlag) IsSliceFlag() bool {
return true return true

View File

@ -7,21 +7,6 @@ import (
type Path = string type Path = string
// TakesValue returns true of the flag takes a value, otherwise false
func (f *PathFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *PathFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *PathFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *PathFlag) GetValue() string { func (f *PathFlag) GetValue() string {
@ -39,11 +24,6 @@ func (f *PathFlag) GetDefaultText() string {
return fmt.Sprintf("%q", f.defaultValue) return fmt.Sprintf("%q", f.defaultValue)
} }
// GetEnvVars returns the env vars for this flag
func (f *PathFlag) GetEnvVars() []string {
return f.EnvVars
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *PathFlag) Apply(set *flag.FlagSet) error { func (f *PathFlag) Apply(set *flag.FlagSet) error {
// set default value so that environment wont be able to overwrite it // set default value so that environment wont be able to overwrite it

View File

@ -5,21 +5,6 @@ import (
"fmt" "fmt"
) )
// TakesValue returns true of the flag takes a value, otherwise false
func (f *StringFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *StringFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *StringFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *StringFlag) GetValue() string { func (f *StringFlag) GetValue() string {
@ -37,11 +22,6 @@ func (f *StringFlag) GetDefaultText() string {
return fmt.Sprintf("%q", f.defaultValue) return fmt.Sprintf("%q", f.defaultValue)
} }
// GetEnvVars returns the env vars for this flag
func (f *StringFlag) GetEnvVars() []string {
return f.EnvVars
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *StringFlag) Apply(set *flag.FlagSet) error { func (f *StringFlag) Apply(set *flag.FlagSet) error {
// set default value so that environment wont be able to overwrite it // set default value so that environment wont be able to overwrite it

View File

@ -77,21 +77,6 @@ func (f *StringSliceFlag) String() string {
return FlagStringer(f) return FlagStringer(f)
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *StringSliceFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *StringSliceFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *StringSliceFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *StringSliceFlag) GetValue() string { func (f *StringSliceFlag) GetValue() string {
@ -114,11 +99,6 @@ func (f *StringSliceFlag) GetDefaultText() string {
return f.GetValue() return f.GetValue()
} }
// GetEnvVars returns the env vars for this flag
func (f *StringSliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// IsSliceFlag implements DocGenerationSliceFlag. // IsSliceFlag implements DocGenerationSliceFlag.
func (f *StringSliceFlag) IsSliceFlag() bool { func (f *StringSliceFlag) IsSliceFlag() bool {
return true return true

View File

@ -224,7 +224,7 @@ func TestFlagsFromEnv(t *testing.T) {
f, ok := test.flag.(DocGenerationFlag) f, ok := test.flag.(DocGenerationFlag)
if !ok { if !ok {
t.Errorf("flag %v needs to implement DocGenerationFlag to retrieve env vars", test.flag) t.Errorf("flag %[1]q (%[1]T) needs to implement DocGenerationFlag to retrieve env vars", test.flag)
} }
envVarSlice := f.GetEnvVars() envVarSlice := f.GetEnvVars()
_ = os.Setenv(envVarSlice[0], test.input) _ = os.Setenv(envVarSlice[0], test.input)

View File

@ -91,21 +91,6 @@ func (t *Timestamp) clone() *Timestamp {
return tc return tc
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *TimestampFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *TimestampFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *TimestampFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *TimestampFlag) GetValue() string { func (f *TimestampFlag) GetValue() string {
@ -127,11 +112,6 @@ func (f *TimestampFlag) GetDefaultText() string {
return "" return ""
} }
// GetEnvVars returns the env vars for this flag
func (f *TimestampFlag) GetEnvVars() []string {
return f.EnvVars
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *TimestampFlag) Apply(set *flag.FlagSet) error { func (f *TimestampFlag) Apply(set *flag.FlagSet) error {
if f.Layout == "" { if f.Layout == "" {

View File

@ -6,21 +6,6 @@ import (
"strconv" "strconv"
) )
// TakesValue returns true of the flag takes a value, otherwise false
func (f *UintFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *UintFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *UintFlag) GetCategory() string {
return f.Category
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *UintFlag) Apply(set *flag.FlagSet) error { func (f *UintFlag) Apply(set *flag.FlagSet) error {
// set default value so that environment wont be able to overwrite it // set default value so that environment wont be able to overwrite it
@ -49,15 +34,6 @@ func (f *UintFlag) Apply(set *flag.FlagSet) error {
return nil return nil
} }
// RunAction executes flag action if set
func (f *UintFlag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.Uint(f.Name))
}
return nil
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *UintFlag) GetValue() string { func (f *UintFlag) GetValue() string {
@ -72,16 +48,20 @@ func (f *UintFlag) GetDefaultText() string {
return fmt.Sprintf("%d", f.defaultValue) return fmt.Sprintf("%d", f.defaultValue)
} }
// GetEnvVars returns the env vars for this flag
func (f *UintFlag) GetEnvVars() []string {
return f.EnvVars
}
// Get returns the flags value in the given Context. // Get returns the flags value in the given Context.
func (f *UintFlag) Get(ctx *Context) uint { func (f *UintFlag) Get(ctx *Context) uint {
return ctx.Uint(f.Name) return ctx.Uint(f.Name)
} }
// RunAction executes flag action if set
func (f *UintFlag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.Uint(f.Name))
}
return nil
}
// Uint looks up the value of a local UintFlag, returns // Uint looks up the value of a local UintFlag, returns
// 0 if not found // 0 if not found
func (cCtx *Context) Uint(name string) uint { func (cCtx *Context) Uint(name string) uint {

View File

@ -6,21 +6,6 @@ import (
"strconv" "strconv"
) )
// TakesValue returns true of the flag takes a value, otherwise false
func (f *Uint64Flag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *Uint64Flag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *Uint64Flag) GetCategory() string {
return f.Category
}
// Apply populates the flag given the flag set and environment // Apply populates the flag given the flag set and environment
func (f *Uint64Flag) Apply(set *flag.FlagSet) error { func (f *Uint64Flag) Apply(set *flag.FlagSet) error {
// set default value so that environment wont be able to overwrite it // set default value so that environment wont be able to overwrite it
@ -49,15 +34,6 @@ func (f *Uint64Flag) Apply(set *flag.FlagSet) error {
return nil return nil
} }
// RunAction executes flag action if set
func (f *Uint64Flag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.Uint64(f.Name))
}
return nil
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *Uint64Flag) GetValue() string { func (f *Uint64Flag) GetValue() string {
@ -72,16 +48,20 @@ func (f *Uint64Flag) GetDefaultText() string {
return fmt.Sprintf("%d", f.defaultValue) return fmt.Sprintf("%d", f.defaultValue)
} }
// GetEnvVars returns the env vars for this flag
func (f *Uint64Flag) GetEnvVars() []string {
return f.EnvVars
}
// Get returns the flags value in the given Context. // Get returns the flags value in the given Context.
func (f *Uint64Flag) Get(ctx *Context) uint64 { func (f *Uint64Flag) Get(ctx *Context) uint64 {
return ctx.Uint64(f.Name) return ctx.Uint64(f.Name)
} }
// RunAction executes flag action if set
func (f *Uint64Flag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.Uint64(f.Name))
}
return nil
}
// Uint64 looks up the value of a local Uint64Flag, returns // Uint64 looks up the value of a local Uint64Flag, returns
// 0 if not found // 0 if not found
func (cCtx *Context) Uint64(name string) uint64 { func (cCtx *Context) Uint64(name string) uint64 {

View File

@ -91,21 +91,6 @@ func (f *Uint64SliceFlag) String() string {
return FlagStringer(f) return FlagStringer(f)
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *Uint64SliceFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *Uint64SliceFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *Uint64SliceFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *Uint64SliceFlag) GetValue() string { func (f *Uint64SliceFlag) GetValue() string {
@ -126,11 +111,6 @@ func (f *Uint64SliceFlag) GetDefaultText() string {
return f.GetValue() return f.GetValue()
} }
// GetEnvVars returns the env vars for this flag
func (f *Uint64SliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// IsSliceFlag implements DocGenerationSliceFlag. // IsSliceFlag implements DocGenerationSliceFlag.
func (f *Uint64SliceFlag) IsSliceFlag() bool { func (f *Uint64SliceFlag) IsSliceFlag() bool {
return true return true
@ -180,6 +160,15 @@ func (f *Uint64SliceFlag) Get(ctx *Context) []uint64 {
return ctx.Uint64Slice(f.Name) return ctx.Uint64Slice(f.Name)
} }
// RunAction executes flag action if set
func (f *Uint64SliceFlag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.Uint64Slice(f.Name))
}
return nil
}
// Uint64Slice looks up the value of a local Uint64SliceFlag, returns // Uint64Slice looks up the value of a local Uint64SliceFlag, returns
// nil if not found // nil if not found
func (cCtx *Context) Uint64Slice(name string) []uint64 { func (cCtx *Context) Uint64Slice(name string) []uint64 {

View File

@ -102,21 +102,6 @@ func (f *UintSliceFlag) String() string {
return FlagStringer(f) return FlagStringer(f)
} }
// TakesValue returns true of the flag takes a value, otherwise false
func (f *UintSliceFlag) TakesValue() bool {
return true
}
// GetUsage returns the usage string for the flag
func (f *UintSliceFlag) GetUsage() string {
return f.Usage
}
// GetCategory returns the category for the flag
func (f *UintSliceFlag) GetCategory() string {
return f.Category
}
// GetValue returns the flags value as string representation and an empty // GetValue returns the flags value as string representation and an empty
// string if the flag takes no value at all. // string if the flag takes no value at all.
func (f *UintSliceFlag) GetValue() string { func (f *UintSliceFlag) GetValue() string {
@ -137,11 +122,6 @@ func (f *UintSliceFlag) GetDefaultText() string {
return f.GetValue() return f.GetValue()
} }
// GetEnvVars returns the env vars for this flag
func (f *UintSliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// IsSliceFlag implements DocGenerationSliceFlag. // IsSliceFlag implements DocGenerationSliceFlag.
func (f *UintSliceFlag) IsSliceFlag() bool { func (f *UintSliceFlag) IsSliceFlag() bool {
return true return true
@ -191,6 +171,15 @@ func (f *UintSliceFlag) Get(ctx *Context) []uint {
return ctx.UintSlice(f.Name) return ctx.UintSlice(f.Name)
} }
// RunAction executes flag action if set
func (f *UintSliceFlag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.UintSlice(f.Name))
}
return nil
}
// UintSlice looks up the value of a local UintSliceFlag, returns // UintSlice looks up the value of a local UintSliceFlag, returns
// nil if not found // nil if not found
func (cCtx *Context) UintSlice(name string) []uint { func (cCtx *Context) UintSlice(name string) []uint {

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/urfave/cli/v2 module github.com/urfave/cli/v3
go 1.18 go 1.18

View File

@ -1,4 +1,4 @@
package cli // import "github.com/urfave/cli/v2" package cli // import "github.com/urfave/cli/v3"
Package cli provides a minimal framework for creating and organizing command Package cli provides a minimal framework for creating and organizing command
line Go applications. cli is designed to be easy to understand and write, line Go applications. cli is designed to be easy to understand and write,
@ -465,7 +465,7 @@ func (f *BoolFlag) Get(ctx *Context) bool
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *BoolFlag) GetCategory() string func (f *BoolFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *BoolFlag) GetDefaultText() string func (f *BoolFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -499,11 +499,12 @@ func (f *BoolFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *BoolFlag) TakesValue() bool func (f *BoolFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type CategorizableFlag interface { type CategorizableFlag interface {
VisibleFlag VisibleFlag
// Returns the category of the flag
GetCategory() string GetCategory() string
} }
CategorizableFlag is an interface that allows us to potentially use a flag CategorizableFlag is an interface that allows us to potentially use a flag
@ -794,7 +795,7 @@ func (f *DurationFlag) Get(ctx *Context) time.Duration
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *DurationFlag) GetCategory() string func (f *DurationFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *DurationFlag) GetDefaultText() string func (f *DurationFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -828,7 +829,7 @@ func (f *DurationFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *DurationFlag) TakesValue() bool func (f *DurationFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type ErrorFormatter interface { type ErrorFormatter interface {
Format(s fmt.State, verb rune) Format(s fmt.State, verb rune)
@ -863,9 +864,14 @@ type ExitErrHandlerFunc func(cCtx *Context, err error)
type Flag interface { type Flag interface {
fmt.Stringer fmt.Stringer
// Apply Flag settings to the given flag set // Apply Flag settings to the given flag set
Apply(*flag.FlagSet) error Apply(*flag.FlagSet) error
// All possible names for this flag
Names() []string Names() []string
// Whether the flag has been set or not
IsSet() bool IsSet() bool
} }
Flag is a common interface related to parsing flags in cli. For more Flag is a common interface related to parsing flags in cli. For more
@ -973,7 +979,7 @@ func (f *Float64Flag) Get(ctx *Context) float64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Float64Flag) GetCategory() string func (f *Float64Flag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Float64Flag) GetDefaultText() string func (f *Float64Flag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1007,7 +1013,7 @@ func (f *Float64Flag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Float64Flag) TakesValue() bool func (f *Float64Flag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Float64Slice struct { type Float64Slice struct {
// Has unexported fields. // Has unexported fields.
@ -1062,7 +1068,7 @@ func (f *Float64SliceFlag) Get(ctx *Context) []float64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Float64SliceFlag) GetCategory() string func (f *Float64SliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Float64SliceFlag) GetDefaultText() string func (f *Float64SliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1146,7 +1152,7 @@ func (f *GenericFlag) Get(ctx *Context) interface{}
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *GenericFlag) GetCategory() string func (f *GenericFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *GenericFlag) GetDefaultText() string func (f *GenericFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1180,7 +1186,7 @@ func (f *GenericFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *GenericFlag) TakesValue() bool func (f *GenericFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Int64Flag struct { type Int64Flag struct {
Name string Name string
@ -1214,7 +1220,7 @@ func (f *Int64Flag) Get(ctx *Context) int64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Int64Flag) GetCategory() string func (f *Int64Flag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Int64Flag) GetDefaultText() string func (f *Int64Flag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1248,7 +1254,7 @@ func (f *Int64Flag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Int64Flag) TakesValue() bool func (f *Int64Flag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Int64Slice struct { type Int64Slice struct {
// Has unexported fields. // Has unexported fields.
@ -1303,7 +1309,7 @@ func (f *Int64SliceFlag) Get(ctx *Context) []int64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Int64SliceFlag) GetCategory() string func (f *Int64SliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Int64SliceFlag) GetDefaultText() string func (f *Int64SliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1346,7 +1352,7 @@ func (f *Int64SliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Int64SliceFlag) TakesValue() bool func (f *Int64SliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type IntFlag struct { type IntFlag struct {
Name string Name string
@ -1380,7 +1386,7 @@ func (f *IntFlag) Get(ctx *Context) int
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *IntFlag) GetCategory() string func (f *IntFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *IntFlag) GetDefaultText() string func (f *IntFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1414,7 +1420,7 @@ func (f *IntFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *IntFlag) TakesValue() bool func (f *IntFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type IntSlice struct { type IntSlice struct {
// Has unexported fields. // Has unexported fields.
@ -1473,7 +1479,7 @@ func (f *IntSliceFlag) Get(ctx *Context) []int
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *IntSliceFlag) GetCategory() string func (f *IntSliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *IntSliceFlag) GetDefaultText() string func (f *IntSliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1516,7 +1522,7 @@ func (f *IntSliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *IntSliceFlag) TakesValue() bool func (f *IntSliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type InvalidFlagAccessFunc func(*Context, string) type InvalidFlagAccessFunc func(*Context, string)
InvalidFlagAccessFunc is executed when an invalid flag is accessed from the InvalidFlagAccessFunc is executed when an invalid flag is accessed from the
@ -1584,7 +1590,7 @@ func (f *PathFlag) Get(ctx *Context) string
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *PathFlag) GetCategory() string func (f *PathFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *PathFlag) GetDefaultText() string func (f *PathFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1618,11 +1624,12 @@ func (f *PathFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *PathFlag) TakesValue() bool func (f *PathFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type RequiredFlag interface { type RequiredFlag interface {
Flag Flag
// whether the flag is a required flag or not
IsRequired() bool IsRequired() bool
} }
RequiredFlag is an interface that allows us to mark flags as required RequiredFlag is an interface that allows us to mark flags as required
@ -1727,7 +1734,7 @@ func (f *StringFlag) Get(ctx *Context) string
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *StringFlag) GetCategory() string func (f *StringFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *StringFlag) GetDefaultText() string func (f *StringFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1761,7 +1768,7 @@ func (f *StringFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *StringFlag) TakesValue() bool func (f *StringFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type StringSlice struct { type StringSlice struct {
// Has unexported fields. // Has unexported fields.
@ -1818,7 +1825,7 @@ func (f *StringSliceFlag) Get(ctx *Context) []string
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *StringSliceFlag) GetCategory() string func (f *StringSliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *StringSliceFlag) GetDefaultText() string func (f *StringSliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1861,7 +1868,7 @@ func (f *StringSliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *StringSliceFlag) TakesValue() bool func (f *StringSliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type SuggestCommandFunc func(commands []*Command, provided string) string type SuggestCommandFunc func(commands []*Command, provided string) string
@ -1930,7 +1937,7 @@ func (f *TimestampFlag) Get(ctx *Context) *time.Time
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *TimestampFlag) GetCategory() string func (f *TimestampFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *TimestampFlag) GetDefaultText() string func (f *TimestampFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1964,7 +1971,7 @@ func (f *TimestampFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *TimestampFlag) TakesValue() bool func (f *TimestampFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Uint64Flag struct { type Uint64Flag struct {
Name string Name string
@ -1998,7 +2005,7 @@ func (f *Uint64Flag) Get(ctx *Context) uint64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Uint64Flag) GetCategory() string func (f *Uint64Flag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Uint64Flag) GetDefaultText() string func (f *Uint64Flag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -2032,7 +2039,7 @@ func (f *Uint64Flag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Uint64Flag) TakesValue() bool func (f *Uint64Flag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Uint64Slice struct { type Uint64Slice struct {
// Has unexported fields. // Has unexported fields.
@ -2087,7 +2094,7 @@ func (f *Uint64SliceFlag) Get(ctx *Context) []uint64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Uint64SliceFlag) GetCategory() string func (f *Uint64SliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Uint64SliceFlag) GetDefaultText() string func (f *Uint64SliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -2117,11 +2124,14 @@ func (f *Uint64SliceFlag) IsVisible() bool
func (f *Uint64SliceFlag) Names() []string func (f *Uint64SliceFlag) Names() []string
Names returns the names of the flag Names returns the names of the flag
func (f *Uint64SliceFlag) RunAction(c *Context) error
RunAction executes flag action if set
func (f *Uint64SliceFlag) String() string func (f *Uint64SliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Uint64SliceFlag) TakesValue() bool func (f *Uint64SliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type UintFlag struct { type UintFlag struct {
Name string Name string
@ -2155,7 +2165,7 @@ func (f *UintFlag) Get(ctx *Context) uint
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *UintFlag) GetCategory() string func (f *UintFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *UintFlag) GetDefaultText() string func (f *UintFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -2189,7 +2199,7 @@ func (f *UintFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *UintFlag) TakesValue() bool func (f *UintFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type UintSlice struct { type UintSlice struct {
// Has unexported fields. // Has unexported fields.
@ -2248,7 +2258,7 @@ func (f *UintSliceFlag) Get(ctx *Context) []uint
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *UintSliceFlag) GetCategory() string func (f *UintSliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *UintSliceFlag) GetDefaultText() string func (f *UintSliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -2278,11 +2288,14 @@ func (f *UintSliceFlag) IsVisible() bool
func (f *UintSliceFlag) Names() []string func (f *UintSliceFlag) Names() []string
Names returns the names of the flag Names returns the names of the flag
func (f *UintSliceFlag) RunAction(c *Context) error
RunAction executes flag action if set
func (f *UintSliceFlag) String() string func (f *UintSliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *UintSliceFlag) TakesValue() bool func (f *UintSliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type VisibleFlag interface { type VisibleFlag interface {
Flag Flag
@ -2300,7 +2313,7 @@ type VisibleFlagCategory interface {
} }
VisibleFlagCategory is a category containing flags. VisibleFlagCategory is a category containing flags.
package altsrc // import "github.com/urfave/cli/v2/altsrc" package altsrc // import "github.com/urfave/cli/v3/altsrc"
FUNCTIONS FUNCTIONS

View File

@ -18,7 +18,7 @@ import (
"runtime" "runtime"
"strings" "strings"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
const ( const (
@ -240,10 +240,10 @@ func TestActionFunc(c *cli.Context) error {
tags := c.String("tags") tags := c.String("tags")
for _, pkg := range c.StringSlice("packages") { for _, pkg := range c.StringSlice("packages") {
packageName := "github.com/urfave/cli/v2" packageName := "github.com/urfave/cli/v3"
if pkg != "cli" { if pkg != "cli" {
packageName = fmt.Sprintf("github.com/urfave/cli/v2/%s", pkg) packageName = fmt.Sprintf("github.com/urfave/cli/v3/%s", pkg)
} }
args := []string{"test"} args := []string{"test"}

View File

@ -3,7 +3,7 @@
package main package main
import ( import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
func main() { func main() {

View File

@ -1,6 +1,3 @@
//go:build go1.18
// +build go1.18
package cli package cli
import ( import (

View File

@ -1,10 +0,0 @@
//go:build !go1.18
// +build !go1.18
package cli
import (
"flag"
)
func unwrapFlagValue(v flag.Value) flag.Value { return v }

View File

@ -1,6 +1,3 @@
//go:build go1.18
// +build go1.18
package cli package cli
import ( import (

View File

@ -1,4 +1,4 @@
package cli // import "github.com/urfave/cli/v2" package cli // import "github.com/urfave/cli/v3"
Package cli provides a minimal framework for creating and organizing command Package cli provides a minimal framework for creating and organizing command
line Go applications. cli is designed to be easy to understand and write, line Go applications. cli is designed to be easy to understand and write,
@ -73,8 +73,7 @@ DESCRIPTION:
OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}}
OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}`
`
CommandHelpTemplate is the text template for the command help topic. cli.go CommandHelpTemplate is the text template for the command help topic. cli.go
uses text/template to render templates. You can render custom help text by uses text/template to render templates. You can render custom help text by
setting this variable. setting this variable.
@ -145,8 +144,7 @@ COMMANDS:{{template "visibleCommandTemplate" .}}{{end}}{{if .VisibleFlagCategori
OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} OPTIONS:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}}
OPTIONS:{{template "visibleFlagTemplate" .}}{{end}} OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}`
`
SubcommandHelpTemplate is the text template for the subcommand help topic. SubcommandHelpTemplate is the text template for the subcommand help topic.
cli.go uses text/template to render templates. You can render custom help cli.go uses text/template to render templates. You can render custom help
text by setting this variable. text by setting this variable.
@ -465,7 +463,7 @@ func (f *BoolFlag) Get(ctx *Context) bool
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *BoolFlag) GetCategory() string func (f *BoolFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *BoolFlag) GetDefaultText() string func (f *BoolFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -499,11 +497,12 @@ func (f *BoolFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *BoolFlag) TakesValue() bool func (f *BoolFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type CategorizableFlag interface { type CategorizableFlag interface {
VisibleFlag VisibleFlag
// Returns the category of the flag
GetCategory() string GetCategory() string
} }
CategorizableFlag is an interface that allows us to potentially use a flag CategorizableFlag is an interface that allows us to potentially use a flag
@ -794,7 +793,7 @@ func (f *DurationFlag) Get(ctx *Context) time.Duration
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *DurationFlag) GetCategory() string func (f *DurationFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *DurationFlag) GetDefaultText() string func (f *DurationFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -828,7 +827,7 @@ func (f *DurationFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *DurationFlag) TakesValue() bool func (f *DurationFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type ErrorFormatter interface { type ErrorFormatter interface {
Format(s fmt.State, verb rune) Format(s fmt.State, verb rune)
@ -863,9 +862,14 @@ type ExitErrHandlerFunc func(cCtx *Context, err error)
type Flag interface { type Flag interface {
fmt.Stringer fmt.Stringer
// Apply Flag settings to the given flag set // Apply Flag settings to the given flag set
Apply(*flag.FlagSet) error Apply(*flag.FlagSet) error
// All possible names for this flag
Names() []string Names() []string
// Whether the flag has been set or not
IsSet() bool IsSet() bool
} }
Flag is a common interface related to parsing flags in cli. For more Flag is a common interface related to parsing flags in cli. For more
@ -973,7 +977,7 @@ func (f *Float64Flag) Get(ctx *Context) float64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Float64Flag) GetCategory() string func (f *Float64Flag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Float64Flag) GetDefaultText() string func (f *Float64Flag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1007,7 +1011,7 @@ func (f *Float64Flag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Float64Flag) TakesValue() bool func (f *Float64Flag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Float64Slice struct { type Float64Slice struct {
// Has unexported fields. // Has unexported fields.
@ -1062,7 +1066,7 @@ func (f *Float64SliceFlag) Get(ctx *Context) []float64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Float64SliceFlag) GetCategory() string func (f *Float64SliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Float64SliceFlag) GetDefaultText() string func (f *Float64SliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1146,7 +1150,7 @@ func (f *GenericFlag) Get(ctx *Context) interface{}
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *GenericFlag) GetCategory() string func (f *GenericFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *GenericFlag) GetDefaultText() string func (f *GenericFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1180,7 +1184,7 @@ func (f *GenericFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *GenericFlag) TakesValue() bool func (f *GenericFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Int64Flag struct { type Int64Flag struct {
Name string Name string
@ -1214,7 +1218,7 @@ func (f *Int64Flag) Get(ctx *Context) int64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Int64Flag) GetCategory() string func (f *Int64Flag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Int64Flag) GetDefaultText() string func (f *Int64Flag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1248,7 +1252,7 @@ func (f *Int64Flag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Int64Flag) TakesValue() bool func (f *Int64Flag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Int64Slice struct { type Int64Slice struct {
// Has unexported fields. // Has unexported fields.
@ -1303,7 +1307,7 @@ func (f *Int64SliceFlag) Get(ctx *Context) []int64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Int64SliceFlag) GetCategory() string func (f *Int64SliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Int64SliceFlag) GetDefaultText() string func (f *Int64SliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1346,7 +1350,7 @@ func (f *Int64SliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Int64SliceFlag) TakesValue() bool func (f *Int64SliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type IntFlag struct { type IntFlag struct {
Name string Name string
@ -1380,7 +1384,7 @@ func (f *IntFlag) Get(ctx *Context) int
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *IntFlag) GetCategory() string func (f *IntFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *IntFlag) GetDefaultText() string func (f *IntFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1414,7 +1418,7 @@ func (f *IntFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *IntFlag) TakesValue() bool func (f *IntFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type IntSlice struct { type IntSlice struct {
// Has unexported fields. // Has unexported fields.
@ -1473,7 +1477,7 @@ func (f *IntSliceFlag) Get(ctx *Context) []int
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *IntSliceFlag) GetCategory() string func (f *IntSliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *IntSliceFlag) GetDefaultText() string func (f *IntSliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1516,7 +1520,7 @@ func (f *IntSliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *IntSliceFlag) TakesValue() bool func (f *IntSliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type InvalidFlagAccessFunc func(*Context, string) type InvalidFlagAccessFunc func(*Context, string)
InvalidFlagAccessFunc is executed when an invalid flag is accessed from the InvalidFlagAccessFunc is executed when an invalid flag is accessed from the
@ -1584,7 +1588,7 @@ func (f *PathFlag) Get(ctx *Context) string
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *PathFlag) GetCategory() string func (f *PathFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *PathFlag) GetDefaultText() string func (f *PathFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1618,11 +1622,12 @@ func (f *PathFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *PathFlag) TakesValue() bool func (f *PathFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type RequiredFlag interface { type RequiredFlag interface {
Flag Flag
// whether the flag is a required flag or not
IsRequired() bool IsRequired() bool
} }
RequiredFlag is an interface that allows us to mark flags as required RequiredFlag is an interface that allows us to mark flags as required
@ -1727,7 +1732,7 @@ func (f *StringFlag) Get(ctx *Context) string
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *StringFlag) GetCategory() string func (f *StringFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *StringFlag) GetDefaultText() string func (f *StringFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1761,7 +1766,7 @@ func (f *StringFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *StringFlag) TakesValue() bool func (f *StringFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type StringSlice struct { type StringSlice struct {
// Has unexported fields. // Has unexported fields.
@ -1818,7 +1823,7 @@ func (f *StringSliceFlag) Get(ctx *Context) []string
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *StringSliceFlag) GetCategory() string func (f *StringSliceFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *StringSliceFlag) GetDefaultText() string func (f *StringSliceFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1861,7 +1866,7 @@ func (f *StringSliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *StringSliceFlag) TakesValue() bool func (f *StringSliceFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type SuggestCommandFunc func(commands []*Command, provided string) string type SuggestCommandFunc func(commands []*Command, provided string) string
@ -1930,7 +1935,7 @@ func (f *TimestampFlag) Get(ctx *Context) *time.Time
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *TimestampFlag) GetCategory() string func (f *TimestampFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *TimestampFlag) GetDefaultText() string func (f *TimestampFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -1964,7 +1969,7 @@ func (f *TimestampFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *TimestampFlag) TakesValue() bool func (f *TimestampFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Uint64Flag struct { type Uint64Flag struct {
Name string Name string
@ -1998,7 +2003,7 @@ func (f *Uint64Flag) Get(ctx *Context) uint64
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *Uint64Flag) GetCategory() string func (f *Uint64Flag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *Uint64Flag) GetDefaultText() string func (f *Uint64Flag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -2032,7 +2037,7 @@ func (f *Uint64Flag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *Uint64Flag) TakesValue() bool func (f *Uint64Flag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type Uint64Slice struct { type Uint64Slice struct {
// Has unexported fields. // Has unexported fields.
@ -2117,6 +2122,9 @@ func (f *Uint64SliceFlag) IsVisible() bool
func (f *Uint64SliceFlag) Names() []string func (f *Uint64SliceFlag) Names() []string
Names returns the names of the flag Names returns the names of the flag
func (f *Uint64SliceFlag) RunAction(c *Context) error
RunAction executes flag action if set
func (f *Uint64SliceFlag) String() string func (f *Uint64SliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
@ -2155,7 +2163,7 @@ func (f *UintFlag) Get(ctx *Context) uint
Get returns the flags value in the given Context. Get returns the flags value in the given Context.
func (f *UintFlag) GetCategory() string func (f *UintFlag) GetCategory() string
GetCategory returns the category for the flag GetCategory returns the category of the flag
func (f *UintFlag) GetDefaultText() string func (f *UintFlag) GetDefaultText() string
GetDefaultText returns the default text for this flag GetDefaultText returns the default text for this flag
@ -2189,7 +2197,7 @@ func (f *UintFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
func (f *UintFlag) TakesValue() bool func (f *UintFlag) TakesValue() bool
TakesValue returns true of the flag takes a value, otherwise false TakesValue returns true if the flag takes a value, otherwise false
type UintSlice struct { type UintSlice struct {
// Has unexported fields. // Has unexported fields.
@ -2278,6 +2286,9 @@ func (f *UintSliceFlag) IsVisible() bool
func (f *UintSliceFlag) Names() []string func (f *UintSliceFlag) Names() []string
Names returns the names of the flag Names returns the names of the flag
func (f *UintSliceFlag) RunAction(c *Context) error
RunAction executes flag action if set
func (f *UintSliceFlag) String() string func (f *UintSliceFlag) String() string
String returns a readable representation of this value (for usage defaults) String returns a readable representation of this value (for usage defaults)
@ -2300,7 +2311,7 @@ type VisibleFlagCategory interface {
} }
VisibleFlagCategory is a category containing flags. VisibleFlagCategory is a category containing flags.
package altsrc // import "github.com/urfave/cli/v2/altsrc" package altsrc // import "github.com/urfave/cli/v3/altsrc"
FUNCTIONS FUNCTIONS

View File

@ -48,6 +48,26 @@ func (f *Float64SliceFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *Float64SliceFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *Float64SliceFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *Float64SliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *Float64SliceFlag) TakesValue() bool {
return "Float64SliceFlag" != "BoolFlag"
}
// GenericFlag is a flag with type Generic // GenericFlag is a flag with type Generic
type GenericFlag struct { type GenericFlag struct {
Name string Name string
@ -99,6 +119,26 @@ func (f *GenericFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *GenericFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *GenericFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *GenericFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *GenericFlag) TakesValue() bool {
return "GenericFlag" != "BoolFlag"
}
// Int64SliceFlag is a flag with type *Int64Slice // Int64SliceFlag is a flag with type *Int64Slice
type Int64SliceFlag struct { type Int64SliceFlag struct {
Name string Name string
@ -143,6 +183,26 @@ func (f *Int64SliceFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *Int64SliceFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *Int64SliceFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *Int64SliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *Int64SliceFlag) TakesValue() bool {
return "Int64SliceFlag" != "BoolFlag"
}
// IntSliceFlag is a flag with type *IntSlice // IntSliceFlag is a flag with type *IntSlice
type IntSliceFlag struct { type IntSliceFlag struct {
Name string Name string
@ -187,6 +247,26 @@ func (f *IntSliceFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *IntSliceFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *IntSliceFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *IntSliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *IntSliceFlag) TakesValue() bool {
return "IntSliceFlag" != "BoolFlag"
}
// PathFlag is a flag with type Path // PathFlag is a flag with type Path
type PathFlag struct { type PathFlag struct {
Name string Name string
@ -238,6 +318,26 @@ func (f *PathFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *PathFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *PathFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *PathFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *PathFlag) TakesValue() bool {
return "PathFlag" != "BoolFlag"
}
// StringSliceFlag is a flag with type *StringSlice // StringSliceFlag is a flag with type *StringSlice
type StringSliceFlag struct { type StringSliceFlag struct {
Name string Name string
@ -284,6 +384,26 @@ func (f *StringSliceFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *StringSliceFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *StringSliceFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *StringSliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *StringSliceFlag) TakesValue() bool {
return "StringSliceFlag" != "BoolFlag"
}
// TimestampFlag is a flag with type *Timestamp // TimestampFlag is a flag with type *Timestamp
type TimestampFlag struct { type TimestampFlag struct {
Name string Name string
@ -337,6 +457,26 @@ func (f *TimestampFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *TimestampFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *TimestampFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *TimestampFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *TimestampFlag) TakesValue() bool {
return "TimestampFlag" != "BoolFlag"
}
// Uint64SliceFlag is a flag with type *Uint64Slice // Uint64SliceFlag is a flag with type *Uint64Slice
type Uint64SliceFlag struct { type Uint64SliceFlag struct {
Name string Name string
@ -381,6 +521,26 @@ func (f *Uint64SliceFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *Uint64SliceFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *Uint64SliceFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *Uint64SliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *Uint64SliceFlag) TakesValue() bool {
return "Uint64SliceFlag" != "BoolFlag"
}
// UintSliceFlag is a flag with type *UintSlice // UintSliceFlag is a flag with type *UintSlice
type UintSliceFlag struct { type UintSliceFlag struct {
Name string Name string
@ -425,6 +585,26 @@ func (f *UintSliceFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *UintSliceFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *UintSliceFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *UintSliceFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *UintSliceFlag) TakesValue() bool {
return "UintSliceFlag" != "BoolFlag"
}
// BoolFlag is a flag with type bool // BoolFlag is a flag with type bool
type BoolFlag struct { type BoolFlag struct {
Name string Name string
@ -476,6 +656,26 @@ func (f *BoolFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *BoolFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *BoolFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *BoolFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *BoolFlag) TakesValue() bool {
return "BoolFlag" != "BoolFlag"
}
// Float64Flag is a flag with type float64 // Float64Flag is a flag with type float64
type Float64Flag struct { type Float64Flag struct {
Name string Name string
@ -525,6 +725,26 @@ func (f *Float64Flag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *Float64Flag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *Float64Flag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *Float64Flag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *Float64Flag) TakesValue() bool {
return "Float64Flag" != "BoolFlag"
}
// IntFlag is a flag with type int // IntFlag is a flag with type int
type IntFlag struct { type IntFlag struct {
Name string Name string
@ -576,6 +796,26 @@ func (f *IntFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *IntFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *IntFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *IntFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *IntFlag) TakesValue() bool {
return "IntFlag" != "BoolFlag"
}
// Int64Flag is a flag with type int64 // Int64Flag is a flag with type int64
type Int64Flag struct { type Int64Flag struct {
Name string Name string
@ -627,6 +867,26 @@ func (f *Int64Flag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *Int64Flag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *Int64Flag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *Int64Flag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *Int64Flag) TakesValue() bool {
return "Int64Flag" != "BoolFlag"
}
// StringFlag is a flag with type string // StringFlag is a flag with type string
type StringFlag struct { type StringFlag struct {
Name string Name string
@ -678,6 +938,26 @@ func (f *StringFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *StringFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *StringFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *StringFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *StringFlag) TakesValue() bool {
return "StringFlag" != "BoolFlag"
}
// DurationFlag is a flag with type time.Duration // DurationFlag is a flag with type time.Duration
type DurationFlag struct { type DurationFlag struct {
Name string Name string
@ -727,6 +1007,26 @@ func (f *DurationFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *DurationFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *DurationFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *DurationFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *DurationFlag) TakesValue() bool {
return "DurationFlag" != "BoolFlag"
}
// UintFlag is a flag with type uint // UintFlag is a flag with type uint
type UintFlag struct { type UintFlag struct {
Name string Name string
@ -778,6 +1078,26 @@ func (f *UintFlag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *UintFlag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *UintFlag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *UintFlag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *UintFlag) TakesValue() bool {
return "UintFlag" != "BoolFlag"
}
// Uint64Flag is a flag with type uint64 // Uint64Flag is a flag with type uint64
type Uint64Flag struct { type Uint64Flag struct {
Name string Name string
@ -829,4 +1149,24 @@ func (f *Uint64Flag) IsVisible() bool {
return !f.Hidden return !f.Hidden
} }
// GetCategory returns the category of the flag
func (f *Uint64Flag) GetCategory() string {
return f.Category
}
// GetUsage returns the usage string for the flag
func (f *Uint64Flag) GetUsage() string {
return f.Usage
}
// GetEnvVars returns the env vars for this flag
func (f *Uint64Flag) GetEnvVars() []string {
return f.EnvVars
}
// TakesValue returns true if the flag takes a value, otherwise false
func (f *Uint64Flag) TakesValue() bool {
return "Uint64Flag" != "BoolFlag"
}
// vim:ro // vim:ro

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v3"
) )
func TestFloat64SliceFlag_SatisfiesFlagInterface(t *testing.T) { func TestFloat64SliceFlag_SatisfiesFlagInterface(t *testing.T) {
@ -35,12 +35,6 @@ func TestGenericFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestGenericFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.GenericFlag{}
_ = f.String()
}
func TestGenericFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestGenericFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.GenericFlag{} var f cli.RequiredFlag = &cli.GenericFlag{}
@ -53,6 +47,12 @@ func TestGenericFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestGenericFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.GenericFlag{}
_ = f.String()
}
func TestInt64SliceFlag_SatisfiesFlagInterface(t *testing.T) { func TestInt64SliceFlag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.Int64SliceFlag{} var f cli.Flag = &cli.Int64SliceFlag{}
@ -98,12 +98,6 @@ func TestPathFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestPathFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.PathFlag{}
_ = f.String()
}
func TestPathFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestPathFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.PathFlag{} var f cli.RequiredFlag = &cli.PathFlag{}
@ -116,6 +110,12 @@ func TestPathFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestPathFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.PathFlag{}
_ = f.String()
}
func TestStringSliceFlag_SatisfiesFlagInterface(t *testing.T) { func TestStringSliceFlag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.StringSliceFlag{} var f cli.Flag = &cli.StringSliceFlag{}
@ -142,12 +142,6 @@ func TestTimestampFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestTimestampFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.TimestampFlag{}
_ = f.String()
}
func TestTimestampFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestTimestampFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.TimestampFlag{} var f cli.RequiredFlag = &cli.TimestampFlag{}
@ -160,6 +154,12 @@ func TestTimestampFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestTimestampFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.TimestampFlag{}
_ = f.String()
}
func TestUint64SliceFlag_SatisfiesFlagInterface(t *testing.T) { func TestUint64SliceFlag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.Uint64SliceFlag{} var f cli.Flag = &cli.Uint64SliceFlag{}
@ -205,12 +205,6 @@ func TestBoolFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestBoolFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.BoolFlag{}
_ = f.String()
}
func TestBoolFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestBoolFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.BoolFlag{} var f cli.RequiredFlag = &cli.BoolFlag{}
@ -223,6 +217,12 @@ func TestBoolFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestBoolFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.BoolFlag{}
_ = f.String()
}
func TestFloat64Flag_SatisfiesFlagInterface(t *testing.T) { func TestFloat64Flag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.Float64Flag{} var f cli.Flag = &cli.Float64Flag{}
@ -230,12 +230,6 @@ func TestFloat64Flag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestFloat64Flag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.Float64Flag{}
_ = f.String()
}
func TestFloat64Flag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestFloat64Flag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.Float64Flag{} var f cli.RequiredFlag = &cli.Float64Flag{}
@ -248,6 +242,12 @@ func TestFloat64Flag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestFloat64Flag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.Float64Flag{}
_ = f.String()
}
func TestIntFlag_SatisfiesFlagInterface(t *testing.T) { func TestIntFlag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.IntFlag{} var f cli.Flag = &cli.IntFlag{}
@ -255,12 +255,6 @@ func TestIntFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestIntFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.IntFlag{}
_ = f.String()
}
func TestIntFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestIntFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.IntFlag{} var f cli.RequiredFlag = &cli.IntFlag{}
@ -273,6 +267,12 @@ func TestIntFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestIntFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.IntFlag{}
_ = f.String()
}
func TestInt64Flag_SatisfiesFlagInterface(t *testing.T) { func TestInt64Flag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.Int64Flag{} var f cli.Flag = &cli.Int64Flag{}
@ -280,12 +280,6 @@ func TestInt64Flag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestInt64Flag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.Int64Flag{}
_ = f.String()
}
func TestInt64Flag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestInt64Flag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.Int64Flag{} var f cli.RequiredFlag = &cli.Int64Flag{}
@ -298,6 +292,12 @@ func TestInt64Flag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestInt64Flag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.Int64Flag{}
_ = f.String()
}
func TestStringFlag_SatisfiesFlagInterface(t *testing.T) { func TestStringFlag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.StringFlag{} var f cli.Flag = &cli.StringFlag{}
@ -305,12 +305,6 @@ func TestStringFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestStringFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.StringFlag{}
_ = f.String()
}
func TestStringFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestStringFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.StringFlag{} var f cli.RequiredFlag = &cli.StringFlag{}
@ -323,6 +317,12 @@ func TestStringFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestStringFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.StringFlag{}
_ = f.String()
}
func TestDurationFlag_SatisfiesFlagInterface(t *testing.T) { func TestDurationFlag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.DurationFlag{} var f cli.Flag = &cli.DurationFlag{}
@ -330,12 +330,6 @@ func TestDurationFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestDurationFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.DurationFlag{}
_ = f.String()
}
func TestDurationFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestDurationFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.DurationFlag{} var f cli.RequiredFlag = &cli.DurationFlag{}
@ -348,6 +342,12 @@ func TestDurationFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestDurationFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.DurationFlag{}
_ = f.String()
}
func TestUintFlag_SatisfiesFlagInterface(t *testing.T) { func TestUintFlag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.UintFlag{} var f cli.Flag = &cli.UintFlag{}
@ -355,12 +355,6 @@ func TestUintFlag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestUintFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.UintFlag{}
_ = f.String()
}
func TestUintFlag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestUintFlag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.UintFlag{} var f cli.RequiredFlag = &cli.UintFlag{}
@ -373,6 +367,12 @@ func TestUintFlag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestUintFlag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.UintFlag{}
_ = f.String()
}
func TestUint64Flag_SatisfiesFlagInterface(t *testing.T) { func TestUint64Flag_SatisfiesFlagInterface(t *testing.T) {
var f cli.Flag = &cli.Uint64Flag{} var f cli.Flag = &cli.Uint64Flag{}
@ -380,12 +380,6 @@ func TestUint64Flag_SatisfiesFlagInterface(t *testing.T) {
_ = f.Names() _ = f.Names()
} }
func TestUint64Flag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.Uint64Flag{}
_ = f.String()
}
func TestUint64Flag_SatisfiesRequiredFlagInterface(t *testing.T) { func TestUint64Flag_SatisfiesRequiredFlagInterface(t *testing.T) {
var f cli.RequiredFlag = &cli.Uint64Flag{} var f cli.RequiredFlag = &cli.Uint64Flag{}
@ -398,4 +392,10 @@ func TestUint64Flag_SatisfiesVisibleFlagInterface(t *testing.T) {
_ = f.IsVisible() _ = f.IsVisible()
} }
func TestUint64Flag_SatisfiesFmtStringerInterface(t *testing.T) {
var f fmt.Stringer = &cli.Uint64Flag{}
_ = f.String()
}
// vim:ro // vim:ro