option

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: MIT Imports: 5 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 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

Types

type BoolFlag

type BoolFlag struct {
	*Flag
	Value bool
}

BoolFlag represents flag which can be specified as bool

type CmdConfig

type CmdConfig struct {
	Toggle bool
}

func NewRootCmdConfigFromViper

func NewRootCmdConfigFromViper() (*CmdConfig, error)

type CmdRawConfig

type CmdRawConfig struct {
	SearchRawCmdConfig `mapstructure:",squash"`
	ImagesRawCmdConfig `mapstructure:",squash"`

	Toggle bool
	DBPath string
}

type Flag

type Flag struct {
	IsPersistent bool
	IsRequired   bool
	IsDirName    bool
	IsFileName   bool
	Shorthand    string
	Name         string
	ViperName    string
	Usage        string
}

Flag represents flag which can be specified

type GetCmdConfig

type GetCmdConfig struct {
	DBPath string
}

GetCmdConfig is config for sum command

func NewGetCmdConfigFromViper

func NewGetCmdConfigFromViper() (*GetCmdConfig, error)

NewGetCmdConfigFromViper generate config for sum command from viper

type ImagesCmdConfig

type ImagesCmdConfig struct {
	*ImagesRawCmdConfig
	DBPath string
}

ImagesCmdConfig is config for sum command

func NewImagesCmdConfigFromViper

func NewImagesCmdConfigFromViper() (*ImagesCmdConfig, error)

NewImagesCmdConfigFromViper generate config for sum command from viper

type ImagesRawCmdConfig

type ImagesRawCmdConfig struct {
	Dir string
}

ImagesRawCmdConfig is raw config for sum command

type IntFlag

type IntFlag struct {
	*Flag
	Value int
}

IntFlag represents flag which can be specified as string

type PrintCmdConfig

type PrintCmdConfig struct {
	DBPath string
}

PrintCmdConfig is config for sum command

func NewPrintCmdConfigFromViper

func NewPrintCmdConfigFromViper() (*PrintCmdConfig, error)

NewPrintCmdConfigFromViper generate config for sum command from viper

type SearchCmdConfig

type SearchCmdConfig struct {
	*SearchRawCmdConfig
	Excludes []string
	Filters  []string
	DBPath   string
}

SearchCmdConfig is config for search command

func NewSearchCmdConfigFromViper

func NewSearchCmdConfigFromViper() (*SearchCmdConfig, error)

NewSearchCmdConfigFromViper generate config for search command from viper

type SearchRawCmdConfig

type SearchRawCmdConfig struct {
	Query             string
	Exclude           string
	Interval          int
	Filter            string
	ConsumerKey       string
	ConsumerSecret    string
	AccessToken       string
	AccessTokenSecret string
}

SearchCmdConfig is raw config for search command

type SetCmdConfig

type SetCmdConfig struct {
	DBPath string
}

SetCmdConfig is config for sum command

func NewSetCmdConfigFromViper

func NewSetCmdConfigFromViper() (*SetCmdConfig, error)

NewSetCmdConfigFromViper generate config for sum command from viper

type StringFlag

type StringFlag struct {
	*Flag
	Value string
}

StringFlag represents flag which can be specified as string

Jump to

Keyboard shortcuts

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