From 7dd8905e5c652cfb40d274a5ca4de26a6edd9d95 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 12 Nov 2024 13:15:53 +0300 Subject: [PATCH] Add https://github.com/jessevdk/go-flags to the project list From original discussion https://github.com/urfave/cli/discussions/2006 --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9626742..07c7e47 100644 --- a/README.md +++ b/README.md @@ -133,8 +133,8 @@ func main() { ``` That code generates next output: -``` -go run ./main.go --help +```sh +$ go run ./main.go --help Usage of _obj/exe/main: -http-host value HTTP host (default 127.0.0.1) @@ -151,7 +151,7 @@ exit status 2 The flag default key string is the struct field name but can be specified in the struct field's tag value. The "flag" key in the struct field's tag value is the key name, followed by an optional comma and options. Examples: -``` +```golang // Field is ignored by this package. Field int `flag:"-"` @@ -175,9 +175,9 @@ Field int `flag:",deprecated"` ## Options for desc tag If you specify description in description tag (`desc` by default) it will be used in USAGE section. -``` +```golang Addr string `desc:"HTTP host"` -``` +```sh this description produces something like: ``` -addr value @@ -189,7 +189,7 @@ this description produces something like: ## Options for Parse function: -``` +```golang // DescTag sets custom description tag. It is "desc" by default. func DescTag(val string) @@ -226,3 +226,4 @@ func Flatten(val bool) * https://github.com/jaffee/commandeer * https://github.com/anacrolix/tagflag + * https://github.com/jessevdk/go-flags