flag

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

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

Functions

func SetModeFlag

func SetModeFlag()

SetModeFlag sets the mode flag

Types

type Logger

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

func NewLogger

func NewLogger(logger commonlogger.Logger) Logger

NewLogger is the logger for the flag

func (Logger) ModeFlagSet

func (l Logger) ModeFlagSet(modeFlag *ModeFlag)

ModeFlagSet is the flag set for the mode

type ModeFlag

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

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

func (*ModeFlag) Set

func (m *ModeFlag) Set(value string) error

Set validates and sets the flag value

func (*ModeFlag) String

func (m *ModeFlag) String() string

String returns the string representation of the flag value

Jump to

Keyboard shortcuts

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