option

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: MIT Imports: 6 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 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 Flag

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

Flag represents flag which can be specified

type IntFlag

type IntFlag struct {
	*Flag
	Value int
}

IntFlag represents flag which can be specified as int

type RootCmdConfig

type RootCmdConfig struct{}

func NewRootCmdConfigFromViper

func NewRootCmdConfigFromViper() (*RootCmdConfig, error)

type RootCmdRawConfig

type RootCmdRawConfig struct {
	File     string
	RootType string
}

type RunCmdConfig

type RunCmdConfig struct {
	FilePath     string
	RootType     string
	Num          int
	InitialState map[string]string
}

func NewRunCmdConfigFromViper

func NewRunCmdConfigFromViper() (*RunCmdConfig, error)

type RunCmdRawConfig

type RunCmdRawConfig struct {
	File  string
	Root  string
	Num   int
	State string // TODO: viper cannot parse map[string]string correctly. See https://github.com/spf13/viper/issues/608
}

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