-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (29 loc) · 629 Bytes
/
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
package main
import (
"log"
"os"
"strings"
"github.com/maxmx03/schemecraft/scheme"
"github.com/maxmx03/schemecraft/system"
vim "github.com/maxmx03/schemecraft/template"
)
const msg = `
Usage:
schemecraft colorscheme.json ... # to generate colorscheme
`
func main() {
if len(os.Args) < 2 {
log.Fatalf(msg)
}
for _, arg := range os.Args[1:] {
var scheme scheme.Scheme = ReadFile(arg)
vim.Create(scheme)
}
}
func ReadFile(file string) scheme.Scheme {
var scheme scheme.Scheme
if strings.HasSuffix(file, "yml") || strings.HasSuffix(file, "yaml") {
scheme = system.ReadYaml(file)
}
return scheme
}