Registry / cli / davidgamba-go-getoptions

davidgamba-go-getoptions

JSON →
library0.33.0gogounverified

Flexible command-line option parser inspired by Perl's GetOpt::Long, supporting long/short options, subcommands, and various argument types.

go get github.com/DavidGamba/go-getoptions
INSTALL
IMPORT
SIG · DAVIDGAMBA-GO-GETO
D
davidgamba-go-getoptions
cligov0.33.0
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.

getoptions
github.com/DavidGamba/go-getoptions

Parse command-line options with a boolean flag.

package main import ( "fmt" "github.com/DavidGamba/go-getoptions" ) func main() { opt := getoptions.New() opt.Bool("verbose", false) remaining, err := opt.Parse(os.Args[1:]) if err != nil { fmt.Fprintf(os.Stderr, "Error: %s\n", err) os.Exit(1) } fmt.Println(remaining) }
Debug
Known issues
gotchaPanics on programmer errors like duplicate aliases or invalid min/max values for SliceMulti.
fix
Ensure all option definitions are unique and valid before parsing.
affects: >=0.1.0
Upgrade
Version history
0.33.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
davidgamba-go-getoptions — go get davidgamba-go-getoptions · libregistry