diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 0000000..4b0401f --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,31 @@ +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", "Verdana.ttf", "font file, tff") + flag.IntVar(&size, "size", 10, "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))) +} diff --git a/go.mod b/go.mod index b5f230d..013c4c5 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/essentialkaos/go-badge +module github.com/therealfakemoot/go-badge go 1.18