|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/therealfakemoot/go-badge"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
style, label, message, color, font string
|
|
|
|
size int
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
flag.StringVar(&style, "style", "flat", "label text")
|
|
|
|
flag.StringVar(&label, "label", "Build", "label text")
|
|
|
|
flag.StringVar(&message, "message", "failed", "message text")
|
|
|
|
flag.StringVar(&color, "color", badge.COLOR_CRITICAL, "label color, hexadecimal")
|
|
|
|
flag.StringVar(&font, "font", "fonts/open_sans/static/OpenSans-Bold.ttf", "font file, tff")
|
|
|
|
flag.IntVar(&size, "size", 12, "font size, pixels")
|
|
|
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
g, err := badge.NewGenerator(font, size)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("error instantiating generator: %s\n", err)
|
|
|
|
}
|
|
|
|
fmt.Println(string(g.GenerateFlat(label, message, color)))
|
|
|
|
}
|