option

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 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 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 {
	*CmdRawConfig
	Out string
}

func NewRootCmdConfigFromViper

func NewRootCmdConfigFromViper() (*CmdConfig, error)

func (*CmdConfig) HasOut

func (c *CmdConfig) HasOut() bool

type CmdRawConfig

type CmdRawConfig struct {
	Norm bool
	Out  string
}

type Flag

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

Flag represents flag which can be specified

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