-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (42 loc) · 1.19 KB
/
main.go
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
42
43
44
45
46
47
48
49
package main
import (
"os"
"github.com/Acid147/pixelpal/commands"
"github.com/Acid147/pixelpal/terminal"
"github.com/mkideal/cli"
)
func main() {
root := &cli.Command{
Desc: "PixelPal is a command line utility for validating and converting the palette of image (especially pixel art) files.",
Fn: commands.Root,
Argv: func() interface{} { return new(terminal.RootOptions) },
}
convert := &cli.Command{
Name: "convert",
Desc: "Convert an image (or multiple) to a target palette.",
Fn: commands.Convert,
Argv: func() interface{} { return new(terminal.ConvertOptions) },
}
validate := &cli.Command{
Name: "validate",
Desc: "Check if an image (or multiple) uses a palette.",
Fn: commands.Validate,
Argv: func() interface{} { return new(terminal.ValidateOptions) },
}
find := &cli.Command{
CanSubRoute: true,
Name: "find",
Desc: "Find the palette used by an image (or multiple).",
Fn: commands.Find,
Argv: func() interface{} { return new(terminal.FindOptions) },
}
if err := cli.Root(
root,
cli.Tree(convert),
cli.Tree(validate),
cli.Tree(find),
).Run(os.Args[1:]); err != nil {
terminal.PrintError(err)
os.Exit(1)
}
}