option

package
v0.0.0-...-c5c9c53 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package option provides utilities of option handling

Index

Constants

This section is empty.

Variables

View Source
var DefaultStringValue = "__DEFAULT_STRING_VALUE__"

Functions

func RegisterBoolFlag

func RegisterBoolFlag(cmd *cobra.Command, flagConfig *BoolFlag) error

RegisterBoolFlag register bool flag to provided cmd and viper

func RegisterFlag

func RegisterFlag(cmd *cobra.Command, flag Flag) error

RegisterFlag register flag to provided cmd and viper

func RegisterFlags

func RegisterFlags(cmd *cobra.Command, flags []Flag) error

RegisterFlags register flags to provided cmd and viper

func RegisterFloat32Flag

func RegisterFloat32Flag(cmd *cobra.Command, flagConfig *Float32Flag) error

RegisterFloat32Flag register int32 flag to provided cmd and viper

func RegisterFloat64Flag

func RegisterFloat64Flag(cmd *cobra.Command, flagConfig *Float64Flag) error

RegisterFloat64Flag register int64 flag to provided cmd and viper

func RegisterInt16Flag

func RegisterInt16Flag(cmd *cobra.Command, flagConfig *Int16Flag) error

RegisterInt16Flag register int16 flag to provided cmd and viper

func RegisterInt32Flag

func RegisterInt32Flag(cmd *cobra.Command, flagConfig *Int32Flag) error

RegisterInt32Flag register int32 flag to provided cmd and viper

func RegisterInt64Flag

func RegisterInt64Flag(cmd *cobra.Command, flagConfig *Int64Flag) error

RegisterInt64Flag register int64 flag to provided cmd and viper

func RegisterInt8Flag

func RegisterInt8Flag(cmd *cobra.Command, flagConfig *Int8Flag) error

RegisterInt8Flag register int8 flag to provided cmd and viper

func RegisterIntFlag

func RegisterIntFlag(cmd *cobra.Command, flagConfig *IntFlag) error

RegisterIntFlag register int flag to provided cmd and viper

func RegisterStringFlag

func RegisterStringFlag(cmd *cobra.Command, flagConfig *StringFlag) error

RegisterStringFlag register string flag to provided cmd and viper

func RegisterUint16Flag

func RegisterUint16Flag(cmd *cobra.Command, flagConfig *Uint16Flag) error

RegisterUint16Flag register int16 flag to provided cmd and viper

func RegisterUint32Flag

func RegisterUint32Flag(cmd *cobra.Command, flagConfig *Uint32Flag) error

RegisterUint32Flag register int32 flag to provided cmd and viper

func RegisterUint64Flag

func RegisterUint64Flag(cmd *cobra.Command, flagConfig *Uint64Flag) error

RegisterUint64Flag register int64 flag to provided cmd and viper

func RegisterUint8Flag

func RegisterUint8Flag(cmd *cobra.Command, flagConfig *Uint8Flag) error

RegisterUint8Flag register int8 flag to provided cmd and viper

func RegisterUintFlag

func RegisterUintFlag(cmd *cobra.Command, flagConfig *UintFlag) error

RegisterUintFlag register int flag to provided cmd and viper

Types

type BaseFlag

type BaseFlag struct {
	IsPersistent bool
	IsRequired   bool
	Shorthand    string
	Name         string
	Usage        string
	ViperName    string
}

BaseFlag represents base command line flag

type BoolFlag

type BoolFlag struct {
	*BaseFlag
	Value bool
}

BoolFlag represents flag which can be specified as bool

type Flag

type Flag interface {
	// contains filtered or unexported methods
}

Flag represents flag which has base flag

type Float32Flag

type Float32Flag struct {
	*BaseFlag
	Value float32
}

Float32Flag represents flag which can be specified as float32

type Float64Flag

type Float64Flag struct {
	*BaseFlag
	Value float64
}

Float64Flag represents flag which can be specified as float64

type Int16Flag

type Int16Flag struct {
	*BaseFlag
	Value int16
}

Int16Flag represents flag which can be specified as int16

type Int32Flag

type Int32Flag struct {
	*BaseFlag
	Value int32
}

Int32Flag represents flag which can be specified as int32

type Int64Flag

type Int64Flag struct {
	*BaseFlag
	Value int64
}

Int64Flag represents flag which can be specified as int64

type Int8Flag

type Int8Flag struct {
	*BaseFlag
	Value int8
}

Int8Flag represents flag which can be specified as int8

type IntFlag

type IntFlag struct {
	*BaseFlag
	Value int
}

IntFlag represents flag which can be specified as int

type RootCmdConfig

type RootCmdConfig struct {
	Verbose bool
}

RootCmdConfig is config for root command

func NewRootCmdConfigFromViper

func NewRootCmdConfigFromViper() (*RootCmdConfig, error)

NewRootCmdConfigFromViper generate config for sum command from viper

type StringFlag

type StringFlag struct {
	*BaseFlag
	Value      string
	IsDirName  bool
	IsFileName bool
}

StringFlag represents flag which can be specified as string

type Uint16Flag

type Uint16Flag struct {
	*BaseFlag
	Value uint16
}

Uint16Flag represents flag which can be specified as uint16

type Uint32Flag

type Uint32Flag struct {
	*BaseFlag
	Value uint32
}

Uint32Flag represents flag which can be specified as uint32

type Uint64Flag

type Uint64Flag struct {
	*BaseFlag
	Value uint64
}

Uint64Flag represents flag which can be specified as uint64

type Uint8Flag

type Uint8Flag struct {
	*BaseFlag
	Value uint8
}

Uint8Flag represents flag which can be specified as uint8

type UintFlag

type UintFlag struct {
	*BaseFlag
	Value uint
}

UintFlag represents flag which can be specified as uint

Jump to

Keyboard shortcuts

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