diff --git a/cmd/wfgraphic-cli/main.go b/cmd/wfgraphic-cli/main.go new file mode 100644 index 0000000..74ff4a6 --- /dev/null +++ b/cmd/wfgraphic-cli/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "os" + "time" + + "github.com/writeas/text-pic" + "github.com/writeas/web-core/log" +) + +func main() { + log.Info("Starting...") + start := time.Now() + err := textpic.Run() + if err != nil { + log.Error("%s", err) + os.Exit(1) + } + log.Info("Completed in %s", time.Since(start)) +} diff --git a/main.go b/textpic.go similarity index 91% rename from main.go rename to textpic.go index f76f2c2..2938065 100644 --- a/main.go +++ b/textpic.go @@ -1,27 +1,13 @@ -package main +package textpic import ( "fmt" "image/color" - "os" "path/filepath" - "time" "github.com/fogleman/gg" - "github.com/writeas/web-core/log" ) -func main() { - log.Info("Starting...") - start := time.Now() - err := run() - if err != nil { - log.Error("%s", err) - os.Exit(1) - } - log.Info("Completed in %s", time.Since(start)) -} - func loadFont(dc *gg.Context, bold bool, points float64) error { fontLoraBoldPath := filepath.Join("fonts", "Lora-Bold.ttf") fontLoraPath := filepath.Join("fonts", "Lora-Regular.ttf") @@ -37,7 +23,7 @@ func loadFont(dc *gg.Context, bold bool, points float64) error { return nil } -func run() error { +func Run() error { w := 900 h := 900 wf := float64(w)