12345678910111213141516171819202122232425262728 |
- package helper
- import (
- "flag"
- )
- type Metal int
- const (
- SILVER Metal = iota
- GOLD
- )
- type Args struct {
- file string
- target Metal
- }
- func ParseArgs() Args {
- var target int
- var file string
- flag.IntVar(&target, "target", int(SILVER), "use -t 0 for silver and -t 1 for gold")
- flag.IntVar(&target, "t", int(SILVER), "use -t 0 for silver and -t 1 for gold")
- flag.StringVar(&file, "file", "", "which file to use")
- flag.Parse()
- return Args{file: file, target: Metal(target)}
- }
|