Closed lil5 closed 1 year ago
I learned a new thing. I like the idea of having short flags. Regarding the --
, is there a reason why --
might be better than -
? I've seen that maximum Go CLIs show example with a single dash.
Mind creating a PR? The tests need to be updated to check the short flags as well. Or I'll take a look at it soon. Thanks!
Double dash flags are normally used to differentiate between a collection of short flags and a single flag rsync -rlptgoD
vs rsync --archive
.
GoLang flags is the exception to use -archive
but will see -av
as a single flag not -a
& -v
put together.
Because of this I use "github.com/urfave/cli/v2"
for my go cli's which work like most expect a cli to work but I can understand if you don't want to add a dependency.
Example: https://cli.urfave.org/v2/examples/flags/
Mind creating a PR
I'll do so once a I know how to continue.
@lil5 let's keep it simple and not add the dependency first. I like the idea of having one letter short flags; just didn't know how to do that in Go.
This should already work with the current code, I suggest changing the documentation to advise people to use double dashes.
A consideration can be made to have short form flags too.
Source: https://www.antoniojgutierrez.com/posts/2021-05-14-short-and-long-options-in-go-flags-pkg/