-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (33 loc) · 727 Bytes
/
Copy pathmain.go
File metadata and controls
41 lines (33 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
"github.com/fatih/color"
"github.com/nomad-software/meme/cli"
"github.com/nomad-software/meme/font"
"github.com/nomad-software/meme/image"
"github.com/nomad-software/meme/output"
)
func main() {
opt := cli.ParseOptions()
if opt.Help {
opt.PrintUsage()
} else if opt.ListTemplates {
for _, id := range cli.ImageIds {
fmt.Fprintln(output.Stdout, color.CyanString("%s", id))
}
} else if opt.Valid() {
font.SetPath(opt)
st := image.Load(opt)
st = image.RenderImage(opt, st)
if opt.ClientID != "" {
url := image.Upload(opt, st)
output.Info(url)
} else {
file := image.Save(opt, st)
output.Info(file)
}
}
}