You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
788 B
Go
32 lines
788 B
Go
1 year ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"flag"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
|
||
1 year ago
|
"code.ndumas.com/ndumas/badges"
|
||
1 year ago
|
)
|
||
|
|
||
|
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")
|
||
1 year ago
|
flag.StringVar(&font, "font", "fonts/open_sans/static/OpenSans-Bold.ttf", "font file, tff")
|
||
|
flag.IntVar(&size, "size", 12, "font size, pixels")
|
||
1 year ago
|
|
||
|
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)))
|
||
|
}
|