-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
55 lines (44 loc) · 983 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"github.com/RichardFevrier/vsc-theme-converter/micro"
"github.com/RichardFevrier/vsc-theme-converter/vscode"
"github.com/RichardFevrier/vsc-theme-converter/wezterm"
"github.com/tailscale/hujson"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: vsc-theme-converter <path_to_vscode_theme_jsonc> [output]")
fmt.Println("[output] can be either 'all' or 'micro' or 'wezterm'. Default {all}")
return
}
path := os.Args[1]
output := "all"
if len(os.Args) > 2 {
output = os.Args[2]
}
invalidData, err := os.ReadFile(path)
if err != nil {
return
}
data, err := hujson.Standardize(invalidData)
if err != nil {
return
}
var theme vscode.VSCodeTheme
if err := json.Unmarshal(data, &theme); err != nil {
log.Fatal(err)
}
switch output {
case "micro":
micro.Generate(theme)
case "wezterm":
wezterm.Generate(theme)
default:
micro.Generate(theme)
wezterm.Generate(theme)
}
}