Categorygithub.com/ViBiOh/flags
modulepackage
1.6.0
Repository: https://github.com/vibioh/flags.git
Documentation: pkg.go.dev

# README

flags

Build

Golang flags parser with zero dependency.

Usage

See simple.go for a basic usage.

Concept

flags gives a simple way to get flag's value from argument or environment variable.

Argument takes priority over environment variable. Argument and environment variable names are generated from configuration you pass.

The FlagSet name is used to prefix all environment variable, replacing - by _.

The prefix name is used then to specialize your flag name (e.g. if you have want to use the same flags twice, you can change the prefix)

The argument's name is in camelCase format. The environement variable name is in SNAKE_UPPER_CASE format.

Flags can take a default value, that can be overriden programatically, always in the case you reuse the same flags twice (see advanced.go example.)

Security

Be careful when using the arguments values, if someone list the processes on the system, they will appear in plain-text. Pass secrets by environment variables: it's less easily visible.

# Packages

No description provided by the author

# Functions

Bool creates a bool flag.
BoolVar binds a bool flag.
Duration creates a duration flag.
DurationVar binds a duration flag.
Float64 creates a float64 flag.
Float64Slice creates a string slice flag.
Float64SliceVar binds a string slice flag.
Float64Var binds a float64 flag.
Int creates an int flag.
Int64 creates an int64 flag.
Int64Var bind an int64 flag.
IntVar bind an int flag.
No description provided by the author
NewOverride create a default override value.
No description provided by the author
No description provided by the author
String creates a string flag.
StringSlice creates a string slice flag.
StringSliceVar binds a string slice flag.
StringVar bind a string flag.
Uint creates an uint flag.
Uint64 creates an uint64 flag.
Uint64Var binds an uint64 flag.
UintVar bind an uint flag.
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
Override is an override of default value.