Implementing simple cli for generating SVGs
parent
5a6c1f1481
commit
a878d5f971
@ -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)))
|
||||
}
|
Loading…
Reference in New Issue