config

package module
v4.0.25 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 51 Imported by: 6

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")

Functions

func HideConsoleWindow added in v4.0.8

func HideConsoleWindow()

HideConsoleWindow is only functional on windows

func IsAdmin

func IsAdmin() bool

func LaunchedFromTerminal added in v4.0.6

func LaunchedFromTerminal() bool

func ManPage

func ManPage(c *CLI) string

func MessageWindow added in v4.0.6

func MessageWindow(title, message string)

MessageWindow prints an error message inside a window, if err != nil

func NotifyWindow added in v4.0.6

func NotifyWindow(title, message string)

NotifyWindow sends a non-blocking system toast/notification to the desktop. Since it's used as a fallback before exiting, it forces a short pause so the OS has enough time to render and display the toast before the process dies.

func OnUnix

func OnUnix() bool

func OnWindows

func OnWindows() bool

func ValidateName

func ValidateName(name string) (err error)

Types

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 (me *Arg) Default() string

func (Arg) Help

func (me Arg) Help() string

func (*Arg) IsRequired

func (me *Arg) IsRequired() bool

func (Arg) Name

func (me Arg) Name() string

func (*Arg) String

func (me *Arg) String() string

func (*Arg) WithDefault

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

func (*Arg) WithHelp

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

func (*Arg) WithRequired

func (me *Arg) WithRequired() *Arg

type BashComplete

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        myCompleter   // 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

func (me *BashComplete) Setup()

type Bool

type Bool = _Var[bool]

type Byte

type Byte = _Var[byte]

type CLI

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

func New

func New(name string, defaultCallback func(Env) error) *CLI

func (*CLI) Abs

func (me *CLI) Abs(p path.Relative) path.Absolute

func (*CLI) AllCommands

func (me *CLI) AllCommands() []string

func (*CLI) Complete

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

func (*CLI) Delete

func (me *CLI) Delete(p path.Relative, recursive bool) error

func (*CLI) ErrorWindow added in v4.0.6

func (me *CLI) ErrorWindow(err error)

func (*CLI) Errorf added in v4.0.2

func (me *CLI) Errorf(format string, vars ...any) error

Errorf prints a message to Stderr()

func (*CLI) Exec

func (me *CLI) Exec(exe *exec.Exec, args ...string) (err error)

Exec runs the program with the given environment and the given arguments environmental variables and config files of the env filesystem are being used

func (*CLI) ExecCommand

func (me *CLI) ExecCommand(exe *exec.Exec, cmd string, args ...string) (exec.Command, error)

ExecCommand runs a single command with the given environment. neither environmental variables nor configs are used in this scenario. However, default values are being set. the cmd must be given in command-path syntax (parent/child/...)

func (*CLI) ExecCommandContext

func (me *CLI) ExecCommandContext(ctx context.Context, exe *exec.Exec, cmd string, args ...string) (exec.Command, error)

ExecCommandContext is like ExecCommand but with a context

func (*CLI) Exists

func (me *CLI) Exists(p path.Relative) bool

func (*CLI) FS

func (me *CLI) FS() fs.FS

func (*CLI) GlobalConfigFile

func (me *CLI) GlobalConfigFile() path.Relative

func (*CLI) Listen added in v4.0.2

func (me *CLI) Listen(ch chan<- exec.Signal) error

somehow we should probably start a goroutine here and get signals from os and transform them into exec.CmdSignals and put them into the channel. but I don't know. somehow we are circumventing the possible testing framework here. IDK what is the best way to handle it

func (*CLI) Load

func (me *CLI) Load(checkmissing bool) (err error)

func (*CLI) LocalConfigFile

func (me *CLI) LocalConfigFile() path.Relative

func (*CLI) Log

func (me *CLI) Log(format string, vars ...any)

func (*CLI) MessageWindow added in v4.0.6

func (me *CLI) MessageWindow(message string)

func (*CLI) Mkdir

func (me *CLI) Mkdir(p path.Relative, recursive bool) error

func (*CLI) ModTime

func (me *CLI) ModTime(p path.Relative) (time.Time, error)

func (*CLI) Name

func (me *CLI) Name() string

func (*CLI) NewProgressbar

func (me *CLI) NewProgressbar(max int64, description string, options ...progressbar.Option) *progressbar.ProgressBar

NewProgressbar returns a progressbar of github.com/schollz/progressbar/v3 Output defaults to App.Stderr()

func (*CLI) NewProgressbarBytes

func (me *CLI) NewProgressbarBytes(maxBytes int64, description string, options ...progressbar.Option) *progressbar.ProgressBar

NewProgressbarBytes is NewProgressbar for bytes

func (*CLI) NewSpinner

func (me *CLI) NewSpinner(description string, options ...progressbar.Option) *progressbar.ProgressBar

NewSpinner returns a progressbar of github.com/schollz/progressbar/v3 that is a spinner Output defaults to App.Stdout()

func (*CLI) NotifyWindow added in v4.0.6

func (me *CLI) NotifyWindow(message string)

func (*CLI) OpenReader

func (me *CLI) OpenReader(p path.Relative) (io.ReadCloser, error)

func (*CLI) OpenWriter

func (me *CLI) OpenWriter(p path.Relative) (io.WriteCloser, error)

func (*CLI) Print

func (me *CLI) Print(vars ...any) error

Print prints a message to Stdout()

func (*CLI) PrintUsage added in v4.0.15

func (me *CLI) PrintUsage(hasError bool)

func (*CLI) Printf

func (me *CLI) Printf(format string, vars ...any) error

Printf prints a message to Stdout()

func (*CLI) Println

func (me *CLI) Println(vars ...any) error

Println prints a message to Stdout()

func (*CLI) ReadDirPaths

func (me *CLI) ReadDirPaths(p path.Relative) ([]path.Relative, error)

func (*CLI) ReadFile

func (me *CLI) ReadFile(f path.Relative) ([]byte, error)

func (*CLI) Reset

func (me *CLI) Reset()

func (*CLI) Run

func (me *CLI) Run() (err error)

func (*CLI) RunAndExit

func (me *CLI) RunAndExit()

func (*CLI) SelectedCommand

func (me *CLI) SelectedCommand() *Command

func (*CLI) Size

func (me *CLI) Size(p path.Relative) int64

func (*CLI) Stderr

func (me *CLI) Stderr() io.Writer

func (*CLI) Stdin

func (me *CLI) Stdin() io.Reader

func (*CLI) Stdout

func (me *CLI) Stdout() io.Writer

func (*CLI) UserConfigFile

func (me *CLI) UserConfigFile() path.Relative

func (*CLI) Vars

func (me *CLI) Vars() []string

func (*CLI) Version

func (me *CLI) Version() *Version

func (*CLI) WD

func (me *CLI) WD() path.Relative

func (*CLI) WithArgs

func (me *CLI) WithArgs(args []string) *CLI

func (*CLI) WithAsciiArt

func (me *CLI) WithAsciiArt() *CLI

func (*CLI) WithCopyright added in v4.0.12

func (me *CLI) WithCopyright(year int, name string) *CLI

func (*CLI) WithDescription

func (me *CLI) WithDescription(descr string) *CLI

func (*CLI) WithEnv

func (me *CLI) WithEnv(env []string) *CLI

func (*CLI) WithExec

func (me *CLI) WithExec(exe *exec.Exec) *CLI

func (*CLI) WithFS

func (me *CLI) WithFS(fsys fs.FS) *CLI

func (*CLI) WithLogger

func (me *CLI) WithLogger(l log.Logger) *CLI

func (*CLI) WithStderr

func (me *CLI) WithStderr(wr io.Writer) *CLI

func (*CLI) WithStdin

func (me *CLI) WithStdin(rd io.Reader, viaPipe bool) *CLI

func (*CLI) WithStdout

func (me *CLI) WithStdout(wr io.Writer) *CLI

func (*CLI) WithVersion

func (me *CLI) WithVersion(maj, min, patch int) *CLI

func (*CLI) WithWD

func (me *CLI) WithWD(wd path.Relative) *CLI

func (*CLI) WithoutColoredHelp added in v4.0.15

func (me *CLI) WithoutColoredHelp() *CLI

func (*CLI) WithoutCompletionAutoConfig

func (me *CLI) WithoutCompletionAutoConfig() *CLI

func (*CLI) WithoutPagedHelp added in v4.0.15

func (me *CLI) WithoutPagedHelp() *CLI

func (*CLI) WriteFile

func (me *CLI) WriteFile(p path.Relative, data []byte, recursive bool) error

type Command

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

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

func (*Command) AddArg

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

func (*Command) AddArgsRemainder

func (me *Command) AddArgsRemainder(name string, val *String) *Arg

AddArgsRemainder adds an pseudo argument that collects all remaining arguments in a string. This method may not be called twice and after defining an remainder no further arguments might be added

func (*Command) AddCommand

func (me *Command) AddCommand(name string, callback func(Env) error) *Command

func (*Command) AddFlag

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

func (*Command) AddStdinArg

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

func (*Command) AddStdinFlag

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

func (*Command) AllArgs

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

func (*Command) Help

func (me *Command) Help() string

func (*Command) Name

func (me *Command) Name() string

func (*Command) NeedsSubCommand

func (me *Command) NeedsSubCommand() *Command

func (*Command) PrintUsage added in v4.0.15

func (me *Command) PrintUsage(hasErr bool)

func (*Command) Relax

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

func (*Command) Require

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

func (*Command) Run

func (me *Command) Run() error

func (*Command) Skip

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

func (*Command) SkipAllBut

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

func (*Command) WithAuthors

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

func (*Command) WithBugs

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

func (*Command) WithConcept

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

func (*Command) WithCopyright

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

func (*Command) WithDocumentation

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

func (*Command) WithExample

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

func (*Command) WithHelp

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

func (*Command) WithHideFromHelp

func (me *Command) WithHideFromHelp() *Command

func (*Command) WithHistory

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

func (*Command) WithLicense

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

func (*Command) WithReportingBugs

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

func (*Command) WithStdinHandler

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

type Date

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

func (*Date) New

func (me *Date) New() Value

func (*Date) Set

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

func (*Date) Type

func (me *Date) Type() string

type DateTime

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

func (*DateTime) New

func (me *DateTime) New() Value

func (*DateTime) Set

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

func (*DateTime) Type

func (me *DateTime) Type() string

type Dir

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

func (*Dir) Complete

func (me *Dir) Complete(app *CLI, prefix string) (suggestions []string, finished bool, err error)

func (*Dir) DoesComplete

func (me *Dir) DoesComplete() bool

func (*Dir) IsDir

func (me *Dir) IsDir() bool

func (*Dir) IsPath

func (me *Dir) IsPath() bool

func (*Dir) Matcher

func (me *Dir) Matcher() *regexp.Regexp

func (*Dir) Matches

func (me *Dir) Matches(name string) error

func (*Dir) New added in v4.0.20

func (me *Dir) New() Value

func (Dir) Path added in v4.0.5

func (me Dir) Path(wd path.Relative) path.Relative

func (*Dir) Set

func (me *Dir) Set(s string) (err error)

func (Dir) Type

func (me Dir) Type() string

type DirRO

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

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) New

func (me *DirRO) New() Value

func (*DirRO) Set

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

func (DirRO) Type

func (DirRO) Type() string

type DirRW

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

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) New

func (me *DirRW) New() Value

func (*DirRW) Set

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

func (DirRW) Type

func (DirRW) Type() string

type DirRWD

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

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) New

func (me *DirRWD) New() Value

func (*DirRWD) Set

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

func (DirRWD) Type

func (DirRWD) Type() string

type DirT

type DirT[F fs.ReadOnly] struct {
	// contains filtered or unexported fields
}

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[F]) New

func (me *DirT[F]) New() Value

func (*DirT[F]) Set

func (me *DirT[F]) Set(s string) (err error)

func (DirT[F]) Type

func (DirT[F]) Type() string

type Env

type Env = exec.Env

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 File

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

func (*File) Complete

func (me *File) Complete(app *CLI, prefix string) (suggestions []string, finished bool, err error)

func (*File) DoesComplete

func (me *File) DoesComplete() bool

func (*File) IsDir

func (me *File) IsDir() bool

func (*File) IsPath

func (me *File) IsPath() bool

func (*File) Matcher

func (me *File) Matcher() *regexp.Regexp

func (*File) Matches

func (me *File) Matches(name string) error

func (*File) New added in v4.0.20

func (me *File) New() Value

func (File) Path added in v4.0.5

func (me File) Path(wd path.Relative) path.Relative

func (*File) Set

func (me *File) Set(s string) (err error)

func (File) Type

func (me File) Type() string

type FileRO

type FileRO struct {
	// 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) New

func (me *FileRO) New() Value

func (*FileRO) Set

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

func (FileRO) Type

func (FileRO) Type() string

type FileRW

type FileRW struct {
	// 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) New

func (me *FileRW) New() Value

func (*FileRW) Set

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

func (FileRW) Type

func (FileRW) Type() string

type FileRWD

type FileRWD struct {
	// 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) New

func (me *FileRWD) New() Value

func (*FileRWD) Set

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

func (FileRWD) Type

func (FileRWD) Type() string

type FileT

type FileT[F fs.ReadOnly] struct {
	// contains filtered or unexported fields
}

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[F]) New

func (me *FileT[F]) New() Value

func (*FileT) Set

func (me *FileT) Set(s string) (err error)

func (FileT[F]) Type

func (FileT[F]) Type() string

type Flag

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

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

func (*Flag) Every

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

is called on every encounter

func (*Flag) Set

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

func (Flag) ShortFlag

func (me Flag) ShortFlag() string

func (*Flag) Unset

func (me *Flag) Unset()

func (*Flag) WithDefault

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

func (*Flag) WithHelp

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

func (*Flag) WithRequired

func (me *Flag) WithRequired() *Flag

func (*Flag) WithShortFlag

func (me *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 (me InvalidNameError) Error() string

type InvalidSelection

type InvalidSelection struct {
	Expected []string
	Value    string
}

func (InvalidSelection) Error

func (me 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

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

func (*JSON) DoesComplete

func (me *JSON) DoesComplete() bool

func (JSON) IsBool

func (me JSON) IsBool() bool

func (JSON) IsSlice

func (me JSON) IsSlice() bool

func (*JSON[T]) New

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

func (*JSON[T]) Set

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

func (*JSON) SetName

func (me *JSON) SetName(name string)

func (JSON[T]) Type

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

func (*JSON) Unset

func (me *JSON) Unset()

type Map

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

func (*Map) Complete

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

func (*Map) DoesComplete

func (me *Map) DoesComplete() bool

func (Map) IsBool

func (me Map) IsBool() bool

func (Map) IsSlice

func (me Map) IsSlice() bool

func (*Map) New

func (me *Map) New() Value

func (*Map) Set

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

func (*Map) SetName

func (me *Map) SetName(name string)

func (Map) Type

func (me Map) Type() string

func (*Map) Unset

func (me *Map) Unset()

type RegExp

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

func (*RegExp) Complete

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

func (*RegExp) DoesComplete

func (me *RegExp) DoesComplete() bool

func (RegExp) IsBool

func (me RegExp) IsBool() bool

func (RegExp) IsSlice

func (me RegExp) IsSlice() bool

func (*RegExp) Matcher

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

func (*RegExp) New

func (me *RegExp) New() Value

func (*RegExp) Set

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

func (*RegExp) SetName

func (me *RegExp) SetName(name string)

func (*RegExp) Unset

func (me *RegExp) Unset()

type STDIN

type STDIN struct{ readerfs.FS }

func (STDIN) Reader

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

func (STDIN) Scheme

func (me STDIN) Scheme() string

type Select

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

	OtherAllowed bool
	// contains filtered or unexported fields
}

func NewSelect

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

func NewSelectWithNew

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

func (Select[T]) Complete

func (me Select[T]) Complete(app *CLI, prefix string) (suggestions []string, finished bool, err error)

func (Select[T]) DoesComplete

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

func (*Select[T]) IsBool

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

func (Select) IsSlice

func (me Select) IsSlice() bool

func (*Select[T]) New

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

func (*Select[T]) Set

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

func (*Select) SetName

func (me *Select) SetName(name string)

func (Select[T]) Type

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

func (*Select) Unset

func (me *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

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

func (*SelectFunc[T]) DoesComplete

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

func (*SelectFunc[T]) IsBool

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

func (SelectFunc) IsSlice

func (me SelectFunc) IsSlice() bool

func (*SelectFunc[T]) New

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

func (*SelectFunc[T]) Set

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

func (*SelectFunc) SetName

func (me *SelectFunc) SetName(name string)

func (*SelectFunc[T]) Type

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

func (*SelectFunc) Unset

func (me *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

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

func (*Slice) DoesComplete

func (me *Slice) DoesComplete() bool

func (Slice[P]) IsBool

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

func (Slice[P]) IsSlice

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

func (*Slice) New

func (me *Slice) New() Value

func (*Slice[P]) Set

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

func (*Slice) SetName

func (me *Slice) SetName(name string)

func (*Slice[P]) String

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

func (Slice[P]) Type

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

func (*Slice) Unset

func (me *Slice) Unset()

type String

type String = _Var[string]

type Time

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

func (*Time) New

func (me *Time) New() Value

func (*Time) Set

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

func (*Time) Type

func (me *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 (me *TimeFormat) New() Value

func (*TimeFormat) Set

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

func (*TimeFormat) Type

func (me *TimeFormat) Type() string

type URL

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

func (*URL) Complete

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

func (*URL) DoesComplete

func (me *URL) DoesComplete() bool

func (URL) IsBool

func (me URL) IsBool() bool

func (URL) IsSlice

func (me URL) IsSlice() bool

func (*URL) New

func (me *URL) New() Value

func (*URL) Set

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

func (*URL) SetName

func (me *URL) SetName(name string)

func (URL) Type

func (me URL) Type() string

func (*URL) Unset

func (me *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(app *CLI, prefix string) (suggestions []string, finished bool, err error)
}

type Version

type Version = version.Version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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