option

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 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 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 {
	Port string
}

func NewRootCmdConfigFromViper

func NewRootCmdConfigFromViper() (*CmdConfig, error)

type CmdRawConfig

type CmdRawConfig struct {
	CmdConfig `mapstructure:",squash"`
}

type Flag

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

Flag represents flag which can be specified

type RebuildWithCmdConfig

type RebuildWithCmdConfig struct {
	Port string
}

func NewRebuildWithCmdConfigFromViper

func NewRebuildWithCmdConfigFromViper() (*RebuildWithCmdConfig, error)

type StringFlag

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

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