go-arg
go-arg copied to clipboard
Struct-based argument parsing in Go
This PR will introduce a v2 of go-arg, to be imported with ```go import "github.com/alexflint/go-arg/v2 ``` It should be backwards with v1 for about 95% of users. If you only...
Right now, this library will always output the result of `Version()` at the start of the usage output: https://github.com/alexflint/go-arg/blob/74af96c6ccf404613c251bca4814d32c69047c5f/usage.go#L84-L86 From my own observations, doing this is fairly uncommon amongst the...
I added config file support to my go-arg using project but due to #94 I could not determine when to read the config. My project hacks support with the builtin...
I was doing some lovely refactoring and I was able to take my main tool's config struct, separate it out, decorate it with the `arg` struct tags, and then embed...
It seems the parsing of lists is done differently than what is common in some other parsing libraries like urfave/cli. I detected this because some tests in https://github.com/purpleidea/mgmt/ started failing...
## Setup ```sh $ cat go.mod module main go 1.21.4 require github.com/alexflint/go-arg v1.4.3 require github.com/alexflint/go-scalar v1.1.0 // indirect ``` ```sh $ cat main.go package main import ( arg "github.com/alexflint/go-arg" )...
For the v2/ API, I recommend we accept the full `os.Args` list, rather than taking off the zeroth argument. Most of the API's out there assume you're passing in the...
If you want to specify both of these, and if they should have different names, then this shows you how it can be done.
Hi @alexflint , this is a small follow-up to PR #223 :) I realized that I forgot to update the write usage function, and it was still printing the output...