helper.go 485 B

12345678910111213141516171819202122232425262728
  1. package helper
  2. import (
  3. "flag"
  4. )
  5. type Metal int
  6. const (
  7. SILVER Metal = iota
  8. GOLD
  9. )
  10. type Args struct {
  11. file string
  12. target Metal
  13. }
  14. func ParseArgs() Args {
  15. var target int
  16. var file string
  17. flag.IntVar(&target, "target", int(SILVER), "use -t 0 for silver and -t 1 for gold")
  18. flag.IntVar(&target, "t", int(SILVER), "use -t 0 for silver and -t 1 for gold")
  19. flag.StringVar(&file, "file", "", "which file to use")
  20. flag.Parse()
  21. return Args{file: file, target: Metal(target)}
  22. }