From d126d337836e03c664467799abfbc81af9fd40dd Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 30 Nov 2023 01:29:16 +0100 Subject: Fix broken examples --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f2916ba..b15aaf4 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,10 @@ func main() { usage() } - for _, opt := range opts { - switch opt.Key { + for _, f := range flags { + switch f.Key { case 'a': - fmt.Println("-a given with argument", opt.Value) + fmt.Println("-a given with argument", f.Value) case 'ß': fmt.Println("-ß given") case 'λ': @@ -74,20 +74,20 @@ func usage() { func main() { flags, optind, err := opts.GetLong(os.Args, []opts.LongOpt{ - {Short: 'a', Long: "add", Arg: Required}, - {Short: 'ß', Long: "sheiße", Arg: None}, - {Short: 'λ', Long: "λεωνίδας", Arg: None}, - {Short: noShortFlag, Long: "no-short", Arg: None}, + {Short: 'a', Long: "add", Arg: opts.Required}, + {Short: 'ß', Long: "sheiße", Arg: opts.None}, + {Short: 'λ', Long: "λεωνίδας", Arg: opts.None}, + {Short: noShortFlag, Long: "no-short", Arg: opts.None}, }) if err != nil { fmt.Fprintf(os.Stderr, "%s: %s\n", os.Args[0], err) usage() } - for _, opt := range opts { - switch opt.Key { + for _, f := range flags { + switch f.Key { case 'a': - fmt.Println("-a or --add given with argument", opt.Value) + fmt.Println("-a or --add given with argument", f.Value) case 'ß': fmt.Println("-ß or --sheiße given") case 'λ': -- cgit v1.2.3