pflagx

package module
v0.0.0-...-8e33440 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CallerSkip = 0

CallerSkip increases the number of callers skipped by caller annotation

Functions

func BindFlags

func BindFlags(cmd *cobra.Command, o *zap.Options)

BindFlags custom flags

func Init

func Init(cmd *cobra.Command, configPath *string)

Init the default flags

func JSONEncoderConfig

func JSONEncoderConfig() zapcore.EncoderConfig

JSONEncoderConfig returns an opinionated EncoderConfig

func LookupEnvOrBool

func LookupEnvOrBool(key string, defaultVal bool) bool

LookupEnvOrBool adds the capability to get env instead of param flag

func LookupEnvOrString

func LookupEnvOrString(key string, defaultVal string) string

LookupEnvOrString adds the capability to get env instead of param flag

func TextEncoderConfig

func TextEncoderConfig() zapcore.EncoderConfig

TextEncoderConfig returns an opinionated EncoderConfig

func UsageFor

func UsageFor(short string) func()

UsageFor function for flag usage

Types

type LevelFlag

type LevelFlag struct {
	ZapOptions *zap.Options
	// contains filtered or unexported fields
}

LevelFlag contains structure for managing zap level

func (LevelFlag) Set

func (l LevelFlag) Set(flagValue string) error

Set flag value for level

func (LevelFlag) String

func (l LevelFlag) String() string

String returns the level flag value

func (LevelFlag) Type

func (l LevelFlag) Type() string

Type returns the level flag type

type OutputFormatFlag

type OutputFormatFlag struct {
	ZapOptions *zap.Options
	// contains filtered or unexported fields
}

OutputFormatFlag contains structure for managing zap encoding

func (*OutputFormatFlag) Set

func (o *OutputFormatFlag) Set(flagValue string) error

Set flag output format value

func (*OutputFormatFlag) String

func (o *OutputFormatFlag) String() string

String returns the output format flag value

func (*OutputFormatFlag) Type

func (o *OutputFormatFlag) Type() string

Type returns the output format flag type

Jump to

Keyboard shortcuts

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