File size: 572 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/target/goalert/expflag"
)
func main() {
out := flag.String("out", "", "output file")
flag.Parse()
if *out == "" {
panic("missing -out")
}
fd, err := os.Create(*out)
if err != nil {
panic(err)
}
defer fd.Close()
var names []string
for _, f := range expflag.AllFlags() {
names = append(names, fmt.Sprintf("'%s'", f))
}
_, err = fmt.Fprintf(fd, `// Code generated by expflag/cmd/tsgen DO NOT EDIT.
type ExpFlag = %s
`, strings.Join(names, " | "))
if err != nil {
panic(err)
}
}
|