utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvVar

func EnvVar(flag string) string

func FlagDesc

func FlagDesc(desc, envVar string) string

func PrintJSON

func PrintJSON(fnc func(cmd *cobra.Command, args []string) (interface{}, error)) func(cmd *cobra.Command, args []string) error

func SanitizeFlagName

func SanitizeFlagName(flag string) string

func ViperFromContext

func ViperFromContext(ctx context.Context) *viper.Viper

func ViperKey

func ViperKey(flag string) string

func WithViper

func WithViper(ctx context.Context, v *viper.Viper) context.Context

Types

type FlagPrefixer

type FlagPrefixer struct {
	// contains filtered or unexported fields
}

func NewFlagPrefixer

func NewFlagPrefixer(prefix string, opts ...Option) FlagPrefixer

func (FlagPrefixer) Env

func (fl FlagPrefixer) Env(s string) string

func (FlagPrefixer) FlagName

func (fl FlagPrefixer) FlagName(s string) string

func (FlagPrefixer) Prefix

func (fl FlagPrefixer) Prefix() string

func (FlagPrefixer) ViperKey

func (fl FlagPrefixer) ViperKey(s string) string

type Option

type Option func(fl *FlagPrefixer)

func SeparatorOpt

func SeparatorOpt(sep string) Option

Jump to

Keyboard shortcuts

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