cmdutil

package
Version: v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindFlag

func BindFlag(v *viper.Viper, flag *pflag.Flag, root string) error

BindFlag moves cobra flags into viper for exclusive use there.

func CheckErr

func CheckErr(err error)

func ConfigPath

func ConfigPath() string

ConfigPath returns the directory path being used by config.

func InitConfig

func InitConfig(name string) error

InitConfig constructs the configuration from a local configuration file or environment variables if available. This is placed in the global `viper` instance.

Types

type BaseCmd

type BaseCmd struct {
	Root  string
	Cmd   *cobra.Command
	Viper *viper.Viper
}

BaseCmd provides helpers for generic sub-commands.

func (*BaseCmd) BindFlag

func (b *BaseCmd) BindFlag(name string) error

BindFlag plumbs a flag into viper so that it can be used exclusively.

func (*BaseCmd) Init

func (b *BaseCmd) Init(root string, cmd *cobra.Command)

Init sets up the cmd to have flags added.

Jump to

Keyboard shortcuts

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