Split program into cmd + pkg
This commit is contained in:
parent
c73e844774
commit
dbd85b75b5
20
cmd/wfgraphic-cli/main.go
Normal file
20
cmd/wfgraphic-cli/main.go
Normal file
@ -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))
|
||||
}
|
@ -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)
|
Loading…
Reference in New Issue
Block a user