diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-11-30 01:29:16 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-11-30 01:29:16 +0100 |
commit | d126d337836e03c664467799abfbc81af9fd40dd (patch) | |
tree | 5612bb0f96834833429da4c8af10860ac48b0dc6 | |
parent | 2b4e159a2472ef78f52f8190552b64015e95c1c5 (diff) |
Fix broken examplesv1.0.1
-rw-r--r-- | README.md | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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 'λ': |