flag

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: GPL-3.0 Imports: 5 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// ModeDev is the development mode
	ModeDev = "dev"

	// ModeProd is the production mode
	ModeProd = "prod"
)

Variables

Mode is the environment mode

View Source
var (
	NilModeFlagError = errors.New("mode flag cannot be nil")
)

Functions

func SetModeFlag

func SetModeFlag()

SetModeFlag sets the mode flag

Types

type Flag added in v0.7.0

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

Flag is a custom flag type

func (*Flag) Set added in v0.7.0

func (f *Flag) Set(value string) error

Set validates and sets the flag value

func (*Flag) String added in v0.7.0

func (f *Flag) String() string

String returns the string representation of the flag value

type Logger

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

Logger is the logger for the flag

func NewLogger

func NewLogger(logger commonlogger.Logger) (*Logger, error)

NewLogger is the logger for the flag

func (*Logger) ModeFlagSet

func (l *Logger) ModeFlagSet(mode *ModeFlag)

ModeFlagSet is the flag set for the mode

type ModeFlag

type ModeFlag struct {
	Flag
}

ModeFlag is a custom flag type for mode

func NewModeFlag

func NewModeFlag(defaultValue string, allowed []string) *ModeFlag

NewModeFlag creates a new ModeFlag with allowed values

func (*ModeFlag) IsDev

func (m *ModeFlag) IsDev() bool

IsDev returns true if the mode is development

func (*ModeFlag) IsProd

func (m *ModeFlag) IsProd() bool

IsProd returns true if the mode is production

Jump to

Keyboard shortcuts

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