24 lines
519 B
Go
24 lines
519 B
Go
package cmd
|
|
|
|
import "errors"
|
|
|
|
type TeamFlag string
|
|
|
|
func (t *TeamFlag) String() string {
|
|
return string(*t)
|
|
}
|
|
|
|
func (t *TeamFlag) Set(v string) error {
|
|
switch v {
|
|
case "laa", "az", "bal", "bos", "chc", "cin", "cle", "col", "det", "hou", "kc", "lad", "wsh", "nym", "oak", "pit", "sd", "sea", "sf", "stl", "tb", "tex", "tor", "min", "phi", "atl", "cws", "mia", "nyy", "mil":
|
|
*t = TeamFlag(v)
|
|
return nil
|
|
default:
|
|
return errors.New("invalid team ID")
|
|
}
|
|
}
|
|
|
|
func (t *TeamFlag) Type() string {
|
|
return "team flag"
|
|
}
|