config

package module
v3.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 37 Imported by: 17

Documentation

Index

Constants

View Source
const (
	MaxLenFlagName    = 18
	MaxLenArgName     = 18
	MaxLenCommandName = 20
	MaxLenAppName     = 30
)

Variables

View Source
var ErrInterrupt = fmt.Errorf("pseudo error to interrupt processing, e.g. for help command")
View Source
var VERSION version.Version

Functions

func IsAdmin added in v3.0.2

func IsAdmin() bool

func ManPage added in v3.0.42

func ManPage(c *App) string

func OnUnix added in v3.0.2

func OnUnix() bool

func OnWindows added in v3.0.2

func OnWindows() bool

func ValidateName

func ValidateName(name string) (err error)

Types

type App

type App struct {
	*Command
	// contains filtered or unexported fields
}

func New

func New(name string, defaultCallback func(Application) error) *App

func (*App) Complete added in v3.0.20

func (c *App) Complete(args []string, partial string) (suggestions []string, finished bool, err error)

func (*App) FS

func (a *App) FS() fs.FS

func (*App) GlobalConfigFile

func (a *App) GlobalConfigFile() path.Relative

func (*App) Load

func (a *App) Load(checkmissing bool) (err error)

func (*App) LocalConfigFile

func (a *App) LocalConfigFile() path.Relative

func (*App) Name

func (a *App) Name() string

func (*App) Reset

func (a *App) Reset()

func (*App) Run

func (a *App) Run() (err error)

func (*App) RunAndExit added in v3.0.21

func (a *App) RunAndExit()

func (*App) SelectedCommand added in v3.0.8

func (a *App) SelectedCommand() *Command

func (*App) Stderr

func (a *App) Stderr() io.Writer

func (*App) Stdin

func (a *App) Stdin() io.Reader

func (*App) Stdout

func (a *App) Stdout() io.Writer

func (*App) Usage

func (p *App) Usage() string

func (*App) UserConfigFile

func (a *App) UserConfigFile() path.Relative

func (*App) Version

func (a *App) Version() string

func (*App) WithArgs

func (a *App) WithArgs(args []string) *App

func (*App) WithAsciiArt

func (a *App) WithAsciiArt() *App

func (*App) WithDescription

func (a *App) WithDescription(descr string) *App

func (*App) WithEnv

func (a *App) WithEnv(env []string) *App

func (*App) WithFS

func (a *App) WithFS(fsys fs.FS) *App

func (*App) WithStdErr

func (a *App) WithStdErr(wr io.Writer) *App

func (*App) WithStdOut

func (a *App) WithStdOut(wr io.Writer) *App

func (*App) WithStdin

func (a *App) WithStdin(rd io.Reader, viaPipe bool) *App

func (*App) WithVersion

func (a *App) WithVersion(maj, min, patch int) *App

func (*App) WithoutCompletionAutoConfig added in v3.0.50

func (a *App) WithoutCompletionAutoConfig() *App

type Application

type Application interface {
	Name() string
	FS() fs.FS
	Stdin() io.Reader
	Stdout() io.Writer
	Stderr() io.Writer
	Version() string
}

type Arg

type Arg struct {
	// contains filtered or unexported fields
}

argument is a parameter that has no flag but is scanned based on the position

func (*Arg) Default

func (a *Arg) Default() string

func (Arg) Help

func (a Arg) Help() string

func (*Arg) IsRequired

func (a *Arg) IsRequired() bool

func (Arg) Name

func (a Arg) Name() string

func (*Arg) String

func (a *Arg) String() string

func (*Arg) WithDefault

func (a *Arg) WithDefault(s string) *Arg

func (*Arg) WithHelp

func (a *Arg) WithHelp(s string) *Arg

func (*Arg) WithRequired

func (a *Arg) WithRequired() *Arg

type BashComplete added in v3.0.4

type BashComplete struct {
	IncludeFile      path.Relative             // the filepath (relative to the FS) where the bash script is located that should be included in the .bashrc
	FS               fs.FS                     // the filesystem that deals with the include file
	Completer        bash_completion.Completer // the completer has the complete method that is called by the bash completion, when the user presses <tab>
	ProgramName      string                    // name of the program (file name)
	EnvVar           string                    // the environmental variable that should be set and checked to determine, if completion is activated
	Command          *Command                  // the command inside the CLI app,beneath which the complete command will reside (the command that is called from the bash voia the include file)
	OnBeforeComplete func() error              // is called on complete before the bash_completion.Completer Complete method is called
	// contains filtered or unexported fields
}

func (*BashComplete) Setup added in v3.0.4

func (r *BashComplete) Setup()

type Bool

type Bool = _Var[bool]

type Byte

type Byte = _Var[byte]

type Command

type Command struct {
	// contains filtered or unexported fields
}

if the name is "", this is the main command

func (*Command) AddArg

func (c *Command) AddArg(name string, val Value) *Arg

func (*Command) AddCommand

func (c *Command) AddCommand(name string, callback func(Application) error) *Command

func (*Command) AddFlag

func (c *Command) AddFlag(name string, val Value) *Flag

func (*Command) AddStdinArg

func (c *Command) AddStdinArg(name string, val Value) *Arg

func (*Command) AddStdinFlag

func (c *Command) AddStdinFlag(name string, val Value) *Flag

func (*Command) AllArgs

func (c *Command) AllArgs(target *[]string)

func (*Command) Help

func (c *Command) Help() string

func (*Command) Name

func (c *Command) Name() string

func (*Command) NeedsSubCommand

func (c *Command) NeedsSubCommand() *Command

func (*Command) Relax

func (c *Command) Relax(flags ...*Flag) *Command

func (*Command) Require

func (c *Command) Require(flags ...*Flag) *Command

func (*Command) Run

func (c *Command) Run() error

func (*Command) Skip

func (c *Command) Skip(flags ...*Flag) *Command

func (*Command) SkipAllBut

func (c *Command) SkipAllBut(except ...*Flag) *Command

func (*Command) Usage

func (c *Command) Usage() string

func (*Command) WithAuthors added in v3.0.42

func (c *Command) WithAuthors(authors ...string) *Command

func (*Command) WithBugs added in v3.0.42

func (c *Command) WithBugs(text string) *Command

func (*Command) WithConcept added in v3.0.42

func (c *Command) WithConcept(text string) *Command

func (*Command) WithCopyright added in v3.0.42

func (c *Command) WithCopyright(text string) *Command

func (*Command) WithDocumentation added in v3.0.42

func (c *Command) WithDocumentation(text string) *Command

func (*Command) WithExample added in v3.0.42

func (c *Command) WithExample(text string) *Command

func (*Command) WithHelp

func (c *Command) WithHelp(help string) *Command

func (*Command) WithHideFromHelp added in v3.0.7

func (c *Command) WithHideFromHelp() *Command

func (*Command) WithHistory added in v3.0.42

func (c *Command) WithHistory(text string) *Command

func (*Command) WithLicense added in v3.0.42

func (c *Command) WithLicense(text string) *Command

func (*Command) WithReportingBugs added in v3.0.42

func (c *Command) WithReportingBugs(text string) *Command

func (*Command) WithStdinHandler

func (c *Command) WithStdinHandler(stdinHandler func(io.Reader) error) *Command

type Date

type Date struct {
	// contains filtered or unexported fields
}

func (*Date) New

func (m *Date) New() Value

func (*Date) Set

func (m *Date) Set(s string) error

func (*Date) Type

func (m *Date) Type() string

type DateTime

type DateTime struct {
	// contains filtered or unexported fields
}

func (*DateTime) New

func (m *DateTime) New() Value

func (*DateTime) Set

func (m *DateTime) Set(s string) error

func (*DateTime) Type

func (m *DateTime) Type() string

type DirLocal added in v3.0.9

type DirLocal struct {
	Val    path.Local
	RegExp *regexp.Regexp
	// contains filtered or unexported fields
}

func (*DirLocal) Complete added in v3.0.20

func (v *DirLocal) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*DirLocal) DoesComplete added in v3.0.20

func (f *DirLocal) DoesComplete() bool

func (DirLocal) IsBool added in v3.0.25

func (v DirLocal) IsBool() bool

func (*DirLocal) IsDir added in v3.0.20

func (f *DirLocal) IsDir() bool

func (*DirLocal) IsPath added in v3.0.20

func (f *DirLocal) IsPath() bool

func (DirLocal) IsSlice added in v3.0.25

func (v DirLocal) IsSlice() bool

func (*DirLocal) Matcher added in v3.0.20

func (f *DirLocal) Matcher() *regexp.Regexp

func (*DirLocal) New added in v3.0.25

func (v *DirLocal) New() Value

func (*DirLocal) Set added in v3.0.9

func (f *DirLocal) Set(s string) (err error)

func (*DirLocal) SetName added in v3.0.25

func (v *DirLocal) SetName(name string)

func (DirLocal) Type added in v3.0.20

func (f DirLocal) Type() string

func (*DirLocal) Unset added in v3.0.25

func (v *DirLocal) Unset()

type DirRO

type DirRO struct {
	FileRO
}

func NewDirRO

func NewDirRO(fsyses ...FSGroupRO) *DirRO

NewDirRO returns a Dir that is readonly. The given filesystems must all implement fs.ExtURLInit and fs.ReadOnly

func (*DirRO) Complete added in v3.0.25

func (v *DirRO) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*DirRO) DoesComplete added in v3.0.25

func (v *DirRO) DoesComplete() bool

func (DirRO) IsBool added in v3.0.25

func (v DirRO) IsBool() bool

func (DirRO) IsSlice added in v3.0.25

func (v DirRO) IsSlice() bool

func (*DirRO) New

func (f *DirRO) New() Value

func (*DirRO) Set

func (f *DirRO) Set(s string) (err error)

func (*DirRO) SetName added in v3.0.25

func (v *DirRO) SetName(name string)

func (DirRO) Type

func (DirRO) Type() string

func (*DirRO) Unset added in v3.0.25

func (v *DirRO) Unset()

type DirRW

type DirRW struct {
	FileRW
}

func NewDirRW

func NewDirRW(fsyses ...FSGroupRW) *DirRW

NewDirRW returns a Dir that is readable and writeable. The given filesystems must all implement FSReadWrite

func (*DirRW) Complete added in v3.0.25

func (v *DirRW) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*DirRW) DoesComplete added in v3.0.25

func (v *DirRW) DoesComplete() bool

func (DirRW) IsBool added in v3.0.25

func (v DirRW) IsBool() bool

func (DirRW) IsSlice added in v3.0.25

func (v DirRW) IsSlice() bool

func (*DirRW) New

func (f *DirRW) New() Value

func (*DirRW) Set

func (f *DirRW) Set(s string) (err error)

func (*DirRW) SetName added in v3.0.25

func (v *DirRW) SetName(name string)

func (DirRW) Type

func (DirRW) Type() string

func (*DirRW) Unset added in v3.0.25

func (v *DirRW) Unset()

type DirRWD

type DirRWD struct {
	FileRWD
}

func NewDirRWD

func NewDirRWD(fsyses ...FSGroupRWD) *DirRWD

NewDirRWD returns a Dir that is readable, writeable and deletable. The given filesystems must all implement FSReadWriteDelete

func (*DirRWD) Complete added in v3.0.25

func (v *DirRWD) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*DirRWD) DoesComplete added in v3.0.25

func (v *DirRWD) DoesComplete() bool

func (DirRWD) IsBool added in v3.0.25

func (v DirRWD) IsBool() bool

func (DirRWD) IsSlice added in v3.0.25

func (v DirRWD) IsSlice() bool

func (*DirRWD) New

func (f *DirRWD) New() Value

func (*DirRWD) Set

func (f *DirRWD) Set(s string) (err error)

func (*DirRWD) SetName added in v3.0.25

func (v *DirRWD) SetName(name string)

func (DirRWD) Type

func (DirRWD) Type() string

func (*DirRWD) Unset added in v3.0.25

func (v *DirRWD) Unset()

type DirRelative added in v3.0.41

type DirRelative struct {
	Val    path.Relative
	RegExp *regexp.Regexp
	// contains filtered or unexported fields
}

func (*DirRelative) Complete added in v3.0.41

func (v *DirRelative) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*DirRelative) DoesComplete added in v3.0.41

func (f *DirRelative) DoesComplete() bool

func (DirRelative) IsBool added in v3.0.41

func (v DirRelative) IsBool() bool

func (*DirRelative) IsDir added in v3.0.41

func (f *DirRelative) IsDir() bool

func (*DirRelative) IsPath added in v3.0.41

func (f *DirRelative) IsPath() bool

func (DirRelative) IsSlice added in v3.0.41

func (v DirRelative) IsSlice() bool

func (*DirRelative) Matcher added in v3.0.41

func (f *DirRelative) Matcher() *regexp.Regexp

func (*DirRelative) New added in v3.0.41

func (v *DirRelative) New() Value

func (*DirRelative) Set added in v3.0.41

func (f *DirRelative) Set(s string) (err error)

func (*DirRelative) SetName added in v3.0.41

func (v *DirRelative) SetName(name string)

func (DirRelative) Type added in v3.0.41

func (f DirRelative) Type() string

func (*DirRelative) Unset added in v3.0.41

func (v *DirRelative) Unset()

type DirT

type DirT[T fs.ReadOnly] struct {
	FileT[T]
}

func NewDirT

func NewDirT[T fs.ReadOnly](fsyses ...fs.ExtGroupable[T]) *DirT[T]

NewDirT returns a Dir given on the based Type T that at least implements fs.ReadOnly, but might be whatever FS interface on top. The given filesystems must all implement fs.ExtURLInit and the given interface type T

func (*DirT) Complete added in v3.0.25

func (v *DirT) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*DirT) DoesComplete added in v3.0.25

func (v *DirT) DoesComplete() bool

func (DirT) IsBool added in v3.0.25

func (v DirT) IsBool() bool

func (DirT) IsSlice added in v3.0.25

func (v DirT) IsSlice() bool

func (*DirT[T]) New

func (f *DirT[T]) New() Value

func (*DirT[T]) Set

func (f *DirT[T]) Set(s string) (err error)

func (*DirT) SetName added in v3.0.25

func (v *DirT) SetName(name string)

func (DirT[T]) Type

func (DirT[T]) Type() string

func (*DirT) Unset added in v3.0.25

func (v *DirT) Unset()

type FSGroupRO

type FSGroupRO = fs.ExtGroupable[fs.ReadOnly]

func FSReadonly

func FSReadonly() []FSGroupRO

func LocalFSReadonly

func LocalFSReadonly() []FSGroupRO

type FSGroupRW

type FSGroupRW = fs.ExtGroupable[fs.ExtWriteable]

func LocalFS_RW

func LocalFS_RW() []FSGroupRW

type FSGroupRWD

type FSGroupRWD = fs.ExtGroupable[fs.FS]

func LocalFS

func LocalFS() []FSGroupRWD

type FileLocal added in v3.0.9

type FileLocal struct {
	Val    path.Local
	RegExp *regexp.Regexp
	// contains filtered or unexported fields
}

func (*FileLocal) Complete added in v3.0.20

func (v *FileLocal) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*FileLocal) DoesComplete added in v3.0.20

func (f *FileLocal) DoesComplete() bool

func (FileLocal) IsBool added in v3.0.25

func (v FileLocal) IsBool() bool

func (*FileLocal) IsDir added in v3.0.20

func (f *FileLocal) IsDir() bool

func (*FileLocal) IsPath added in v3.0.20

func (f *FileLocal) IsPath() bool

func (FileLocal) IsSlice added in v3.0.25

func (v FileLocal) IsSlice() bool

func (*FileLocal) Matcher added in v3.0.20

func (f *FileLocal) Matcher() *regexp.Regexp

func (*FileLocal) New added in v3.0.25

func (v *FileLocal) New() Value

func (*FileLocal) Set added in v3.0.9

func (f *FileLocal) Set(s string) (err error)

func (*FileLocal) SetName added in v3.0.25

func (v *FileLocal) SetName(name string)

func (FileLocal) Type added in v3.0.20

func (f FileLocal) Type() string

func (*FileLocal) Unset added in v3.0.25

func (v *FileLocal) Unset()

type FileRO

type FileRO struct {
	fs.PathT[fs.ReadOnly]
	Group *fs.Group[fs.ReadOnly]
	// contains filtered or unexported fields
}

func NewFileRO

func NewFileRO(fsyses ...FSGroupRO) *FileRO

NewFileRO returns a File that is readonly. The given filesystems must all implement fs.ExtGroupable and fs.ReadOnly

func (*FileRO) Complete added in v3.0.25

func (v *FileRO) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*FileRO) DoesComplete added in v3.0.25

func (v *FileRO) DoesComplete() bool

func (FileRO) IsBool added in v3.0.25

func (v FileRO) IsBool() bool

func (FileRO) IsSlice added in v3.0.25

func (v FileRO) IsSlice() bool

func (*FileRO) New

func (f *FileRO) New() Value

func (*FileRO) Set

func (f *FileRO) Set(s string) (err error)

func (*FileRO) SetName added in v3.0.25

func (v *FileRO) SetName(name string)

func (FileRO) Type

func (FileRO) Type() string

func (*FileRO) Unset added in v3.0.25

func (v *FileRO) Unset()

type FileRW

type FileRW struct {
	fs.PathRW[fs.ExtWriteable]
	Group *fs.Group[fs.ExtWriteable]
	// contains filtered or unexported fields
}

func NewFileRW

func NewFileRW(fsyses ...FSGroupRW) *FileRW

NewFileRW returns a File that is readable and writeable. The given filesystems must all implement fs.ExtGroupable and fs.ExtWriteable

func (*FileRW) Complete added in v3.0.25

func (v *FileRW) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*FileRW) DoesComplete added in v3.0.25

func (v *FileRW) DoesComplete() bool

func (FileRW) IsBool added in v3.0.25

func (v FileRW) IsBool() bool

func (FileRW) IsSlice added in v3.0.25

func (v FileRW) IsSlice() bool

func (*FileRW) New

func (f *FileRW) New() Value

func (*FileRW) Set

func (f *FileRW) Set(s string) (err error)

func (*FileRW) SetName added in v3.0.25

func (v *FileRW) SetName(name string)

func (FileRW) Type

func (FileRW) Type() string

func (*FileRW) Unset added in v3.0.25

func (v *FileRW) Unset()

type FileRWD

type FileRWD struct {
	fs.PathRWD
	Group *fs.Group[fs.FS]
	// contains filtered or unexported fields
}

func NewFileRWD

func NewFileRWD(fsyses ...FSGroupRWD) *FileRWD

NewFileRWD returns a File that is readable, writeable and deletable. The given filesystems must all implement fs.ExtGroupable and fs.FS

func (*FileRWD) Complete added in v3.0.25

func (v *FileRWD) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*FileRWD) DoesComplete added in v3.0.25

func (v *FileRWD) DoesComplete() bool

func (FileRWD) IsBool added in v3.0.25

func (v FileRWD) IsBool() bool

func (FileRWD) IsSlice added in v3.0.25

func (v FileRWD) IsSlice() bool

func (*FileRWD) New

func (f *FileRWD) New() Value

func (*FileRWD) Set

func (f *FileRWD) Set(s string) (err error)

func (*FileRWD) SetName added in v3.0.25

func (v *FileRWD) SetName(name string)

func (FileRWD) Type

func (FileRWD) Type() string

func (*FileRWD) Unset added in v3.0.25

func (v *FileRWD) Unset()

type FileRelative added in v3.0.41

type FileRelative struct {
	Val    path.Relative
	RegExp *regexp.Regexp
	// contains filtered or unexported fields
}

func (*FileRelative) Complete added in v3.0.41

func (v *FileRelative) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*FileRelative) DoesComplete added in v3.0.41

func (f *FileRelative) DoesComplete() bool

func (FileRelative) IsBool added in v3.0.41

func (v FileRelative) IsBool() bool

func (*FileRelative) IsDir added in v3.0.41

func (f *FileRelative) IsDir() bool

func (*FileRelative) IsPath added in v3.0.41

func (f *FileRelative) IsPath() bool

func (FileRelative) IsSlice added in v3.0.41

func (v FileRelative) IsSlice() bool

func (*FileRelative) Matcher added in v3.0.41

func (f *FileRelative) Matcher() *regexp.Regexp

func (*FileRelative) New added in v3.0.41

func (v *FileRelative) New() Value

func (*FileRelative) Set added in v3.0.41

func (f *FileRelative) Set(s string) (err error)

func (*FileRelative) SetName added in v3.0.41

func (v *FileRelative) SetName(name string)

func (FileRelative) Type added in v3.0.41

func (f FileRelative) Type() string

func (*FileRelative) Unset added in v3.0.41

func (v *FileRelative) Unset()

type FileT

type FileT[T fs.ReadOnly] struct {
	PathT[T]
}

func NewFileT

func NewFileT[T fs.ReadOnly](fsyses ...fs.ExtGroupable[T]) *FileT[T]

NewFileT returns a File given on the based Type T that at least implements fs.ReadOnly, but might be whatever FS interface on top. The given filesystems must all implement fs.ExtGroupable and the given interface type T

func (*FileT) Complete added in v3.0.25

func (v *FileT) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*FileT) DoesComplete added in v3.0.25

func (v *FileT) DoesComplete() bool

func (FileT) IsBool added in v3.0.25

func (v FileT) IsBool() bool

func (FileT) IsSlice added in v3.0.25

func (v FileT) IsSlice() bool

func (*FileT[T]) New

func (f *FileT[T]) New() Value

func (*FileT) SetName added in v3.0.25

func (v *FileT) SetName(name string)

func (FileT[T]) Type

func (FileT[T]) Type() string

func (*FileT) Unset added in v3.0.25

func (v *FileT) Unset()

type Flag

type Flag struct {
	Arg
	// contains filtered or unexported fields
}

flag has -- prefix when called, or - for shortflag

func (*Flag) Every

func (a *Flag) Every(s string) error

is called on every encounter

func (*Flag) Set

func (a *Flag) Set(s string) error

func (Flag) ShortFlag

func (a Flag) ShortFlag() string

func (*Flag) Unset added in v3.0.20

func (a *Flag) Unset()

func (*Flag) WithDefault

func (a *Flag) WithDefault(s string) *Flag

func (*Flag) WithHelp

func (a *Flag) WithHelp(s string) *Flag

func (*Flag) WithRequired

func (a *Flag) WithRequired() *Flag

func (*Flag) WithShortFlag

func (a *Flag) WithShortFlag(r rune) *Flag

type Float32

type Float32 = _Var[float32]

type Float64

type Float64 = _Var[float64]

type Int

type Int = _Var[int]

type InvalidNameError

type InvalidNameError string

func (InvalidNameError) Error

func (e InvalidNameError) Error() string

type InvalidSelection

type InvalidSelection struct {
	Expected []string
	Value    string
}

func (InvalidSelection) Error

func (e InvalidSelection) Error() string

type JSON

type JSON[T any] struct {
	Val T
	// contains filtered or unexported fields
}

func NewJSON

func NewJSON[T any]() *JSON[T]

func (*JSON) Complete added in v3.0.25

func (v *JSON) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*JSON) DoesComplete added in v3.0.25

func (v *JSON) DoesComplete() bool

func (JSON) IsBool added in v3.0.25

func (v JSON) IsBool() bool

func (JSON) IsSlice added in v3.0.25

func (v JSON) IsSlice() bool

func (*JSON[T]) New

func (m *JSON[T]) New() Value

func (*JSON[T]) Set

func (m *JSON[T]) Set(s string) (err error)

func (*JSON) SetName added in v3.0.25

func (v *JSON) SetName(name string)

func (JSON[T]) Type

func (m JSON[T]) Type() string

func (*JSON) Unset added in v3.0.25

func (v *JSON) Unset()

type Map

type Map struct {
	Vals map[string]any
	// contains filtered or unexported fields
}

func (*Map) Complete added in v3.0.25

func (v *Map) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*Map) DoesComplete added in v3.0.25

func (v *Map) DoesComplete() bool

func (Map) IsBool added in v3.0.25

func (v Map) IsBool() bool

func (Map) IsSlice added in v3.0.25

func (v Map) IsSlice() bool

func (*Map) New added in v3.0.25

func (v *Map) New() Value

func (*Map) Set

func (m *Map) Set(s string) (err error)

func (*Map) SetName added in v3.0.25

func (v *Map) SetName(name string)

func (Map) Type

func (m Map) Type() string

func (*Map) Unset added in v3.0.25

func (v *Map) Unset()

type PathT

type PathT[T fs.ReadOnly] struct {
	fs.PathT[T]
	Group *fs.Group[T]
	// contains filtered or unexported fields
}

func (*PathT) Complete added in v3.0.25

func (v *PathT) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*PathT) DoesComplete added in v3.0.25

func (v *PathT) DoesComplete() bool

func (PathT) IsBool added in v3.0.25

func (v PathT) IsBool() bool

func (PathT) IsSlice added in v3.0.25

func (v PathT) IsSlice() bool

func (*PathT[T]) New

func (f *PathT[T]) New() Value

func (*PathT[T]) Set

func (f *PathT[T]) Set(s string) (err error)

func (*PathT) SetName added in v3.0.25

func (v *PathT) SetName(name string)

func (*PathT) Unset added in v3.0.25

func (v *PathT) Unset()

type RegExp added in v3.0.39

type RegExp struct {
	RegExp *regexp.Regexp
	// contains filtered or unexported fields
}

func (*RegExp) Complete added in v3.0.39

func (v *RegExp) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*RegExp) DoesComplete added in v3.0.39

func (v *RegExp) DoesComplete() bool

func (RegExp) IsBool added in v3.0.39

func (v RegExp) IsBool() bool

func (RegExp) IsSlice added in v3.0.39

func (v RegExp) IsSlice() bool

func (*RegExp) Matcher added in v3.0.39

func (f *RegExp) Matcher() *regexp.Regexp

func (*RegExp) New added in v3.0.39

func (v *RegExp) New() Value

func (*RegExp) Set added in v3.0.39

func (f *RegExp) Set(s string) (err error)

func (*RegExp) SetName added in v3.0.39

func (v *RegExp) SetName(name string)

func (*RegExp) Unset added in v3.0.39

func (v *RegExp) Unset()

type STDIN

type STDIN struct {
	readerfs.FS
}

func (STDIN) Reader

func (f STDIN) Reader(path.Relative) (io.ReadCloser, error)

func (STDIN) Scheme

func (f STDIN) Scheme() string

type Select

type Select[T value.StrConverteable] struct {
	//Var[string]
	Options []string

	OtherAllowed bool
	// contains filtered or unexported fields
}

func NewSelect added in v3.0.2

func NewSelect[T value.StrConverteable](options ...string) Select[T]

func NewSelectWithNew added in v3.0.2

func NewSelectWithNew[T value.StrConverteable](options ...string) Select[T]

func (Select[T]) Complete added in v3.0.20

func (m Select[T]) Complete(prefix string) (suggestions []string, finished bool, err error)

func (Select[T]) DoesComplete added in v3.0.20

func (m Select[T]) DoesComplete() bool

func (*Select[T]) IsBool

func (m *Select[T]) IsBool() bool

func (Select) IsSlice added in v3.0.25

func (v Select) IsSlice() bool

func (*Select[T]) New

func (m *Select[T]) New() Value

func (*Select[T]) Set

func (m *Select[T]) Set(s string) (err error)

func (*Select) SetName added in v3.0.25

func (v *Select) SetName(name string)

func (Select[T]) Type

func (m Select[T]) Type() string

func (*Select) Unset added in v3.0.25

func (v *Select) Unset()

type SelectFunc

type SelectFunc[T value.StrConverteable] struct {
	OtherAllowed bool
	// contains filtered or unexported fields
}

func NewSelectFunc

func NewSelectFunc[T value.StrConverteable](fn func() []string) SelectFunc[T]

func (*SelectFunc[T]) Complete added in v3.0.20

func (m *SelectFunc[T]) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*SelectFunc[T]) DoesComplete added in v3.0.20

func (m *SelectFunc[T]) DoesComplete() bool

func (*SelectFunc[T]) IsBool

func (m *SelectFunc[T]) IsBool() bool

func (SelectFunc) IsSlice added in v3.0.25

func (v SelectFunc) IsSlice() bool

func (*SelectFunc[T]) New

func (m *SelectFunc[T]) New() Value

func (*SelectFunc[T]) Set

func (m *SelectFunc[T]) Set(s string) (err error)

func (*SelectFunc) SetName added in v3.0.25

func (v *SelectFunc) SetName(name string)

func (*SelectFunc[T]) Type

func (m *SelectFunc[T]) Type() string

func (*SelectFunc) Unset added in v3.0.25

func (v *SelectFunc) Unset()

type Slice

type Slice[P Value] struct {
	Vals []P
	// contains filtered or unexported fields
}

func NewSlice

func NewSlice[P Value](v P) Slice[P]

func (*Slice) Complete added in v3.0.25

func (v *Slice) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*Slice) DoesComplete added in v3.0.25

func (v *Slice) DoesComplete() bool

func (Slice[P]) IsBool

func (m Slice[P]) IsBool() bool

func (Slice[P]) IsSlice

func (m Slice[P]) IsSlice() bool

func (*Slice) New added in v3.0.25

func (v *Slice) New() Value

func (*Slice[P]) Set

func (m *Slice[P]) Set(s string) (err error)

func (*Slice) SetName added in v3.0.25

func (v *Slice) SetName(name string)

func (*Slice[P]) String

func (m *Slice[P]) String() string

func (Slice[P]) Type

func (m Slice[P]) Type() string

func (*Slice) Unset added in v3.0.25

func (v *Slice) Unset()

type String

type String = _Var[string]

type Time

type Time struct {
	// contains filtered or unexported fields
}

func (*Time) New

func (m *Time) New() Value

func (*Time) Set

func (m *Time) Set(s string) error

func (*Time) Type

func (m *Time) Type() string

type TimeFormat

type TimeFormat struct {
	Format string
	// contains filtered or unexported fields
}

func NewTimeFormat

func NewTimeFormat(format string) TimeFormat

func (*TimeFormat) New

func (m *TimeFormat) New() Value

func (*TimeFormat) Set

func (m *TimeFormat) Set(s string) error

func (*TimeFormat) Type

func (m *TimeFormat) Type() string

type URL

type URL struct {
	Val url.URL
	// contains filtered or unexported fields
}

func (*URL) Complete added in v3.0.25

func (v *URL) Complete(prefix string) (suggestions []string, finished bool, err error)

func (*URL) DoesComplete added in v3.0.25

func (v *URL) DoesComplete() bool

func (URL) IsBool added in v3.0.25

func (v URL) IsBool() bool

func (URL) IsSlice added in v3.0.25

func (v URL) IsSlice() bool

func (*URL) New added in v3.0.25

func (v *URL) New() Value

func (*URL) Set

func (m *URL) Set(s string) (err error)

func (*URL) SetName added in v3.0.25

func (v *URL) SetName(name string)

func (URL) Type

func (m URL) Type() string

func (*URL) Unset added in v3.0.25

func (v *URL) Unset()

type Uint

type Uint = _Var[uint]

type Value

type Value interface {
	flag.Value
	Type() string
	Unset()
	Err() error
	IsSet() bool
	IsSlice() bool
	IsBool() bool
	New() Value
	DoesComplete() bool // should return true for bool, select and files/dirs and false otherwise
	Complete(prefix string) (suggestions []string, finished bool, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL