cobraviper

package
v0.0.0-...-a786b95 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binder

type Binder struct {
	Viper *viper.Viper
}

func NewBinder

func NewBinder() *Binder

func (*Binder) BindInt

func (b *Binder) BindInt(flagSet *pflag.FlagSet, arg *IntArgument)

func (*Binder) BindString

func (b *Binder) BindString(flagSet *pflag.FlagSet, arg *StringArgument)

func (*Binder) GetInt

func (b *Binder) GetInt(cmd *cobra.Command, arg *IntArgument) (*int, error)

func (*Binder) GetRequiredInt

func (b *Binder) GetRequiredInt(cmd *cobra.Command, arg *IntArgument) (int, error)

func (*Binder) GetRequiredString

func (b *Binder) GetRequiredString(cmd *cobra.Command, arg *StringArgument) (string, error)

func (*Binder) GetString

func (b *Binder) GetString(cmd *cobra.Command, arg *StringArgument) string

type IntArgument

type IntArgument struct {
	ArgumentName string
	EnvName      string
	Short        string
	Usage        string
	DefaultValue *int
	Max          *int
	Min          *int
}

type IntValue

type IntValue struct {
	Val *int
}

func NewIntValue

func NewIntValue(val *int) *IntValue

func (*IntValue) Set

func (i *IntValue) Set(strVal string) error

func (*IntValue) String

func (i *IntValue) String() string

func (*IntValue) Type

func (i *IntValue) Type() string

type StringArgument

type StringArgument struct {
	ArgumentName string
	EnvName      string
	Short        string
	Usage        string
	DefaultValue string
}

type StringValue

type StringValue string

func NewStringValue

func NewStringValue(val string) *StringValue

func (*StringValue) Set

func (s *StringValue) Set(val string) error

func (*StringValue) String

func (s *StringValue) String() string

func (*StringValue) Type

func (s *StringValue) Type() string

Jump to

Keyboard shortcuts

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