Registry / cli / thediveo-enumflag

thediveo-enumflag

JSON →
library0.10.1gogounverified

Package enumflag supplements Go CLI flag handling with enumeration flags for spf13/cobra and spf13/pflag.

go get github.com/thediveo/enumflag
INSTALL
IMPORT
SIG · THEDIVEO-ENUMFLAG
T
thediveo-enumflag
cligov0.10.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

enumflag
github.com/thediveo/enumflag

Defines an enum flag type and parses it from command-line arguments.

package main import ( "flag" "fmt" "github.com/thediveo/enumflag" ) type Mode enumflag.Flag const ( ModeFoo Mode = iota ModeBar ) var modeIds = map[Mode][]string{ModeFoo: {"foo"}, ModeBar: {"bar"}} func main() { var mode Mode enumflag.New(&mode, "mode", modeIds, enumflag.EnumCaseSensitive) flag.Parse() fmt.Println("Mode:", mode) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.10.1latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
22
Resources
thediveo-enumflag — go get thediveo-enumflag · libregistry