-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
97 lines (86 loc) · 2.97 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package main
import (
"bytes"
_ "embed"
"github.com/arelate/theo/cli"
"github.com/arelate/theo/data"
"github.com/boggydigital/clo"
"github.com/boggydigital/nod"
"github.com/boggydigital/pathways"
"os"
)
var (
//go:embed "cli-commands.txt"
cliCommands []byte
//go:embed "cli-help.txt"
cliHelp []byte
)
func main() {
nod.EnableStdOutPresenter()
ns := nod.Begin("theo is complementing vangogh experience")
defer ns.End()
theoRootDir, err := data.InitRootDir()
if err != nil {
_ = ns.EndWithError(err)
}
if err := pathways.Setup("",
theoRootDir,
data.RelToAbsDirs,
data.AllAbsDirs...); err != nil {
_ = ns.EndWithError(err)
os.Exit(1)
}
defs, err := clo.Load(
bytes.NewBuffer(cliCommands),
bytes.NewBuffer(cliHelp),
nil)
if err != nil {
_ = ns.EndWithError(err)
os.Exit(1)
}
clo.HandleFuncs(map[string]clo.Handler{
"add-steam-shortcut": cli.AddSteamShortcutHandler,
"archive-prefix": cli.ArchivePrefixHandler,
"backup-metadata": cli.BackupMetadataHandler,
"default-prefix-env": cli.DefaultPrefixEnvHandler,
"delete-prefix-env": cli.DeletePrefixEnvHandler,
"delete-prefix-exe-path": cli.DeletePrefixExePathHandler,
"download": cli.DownloadHandler,
"install": cli.InstallHandler,
"list-installed": cli.ListInstalledHandler,
"list-prefix-env": cli.ListPrefixEnvHandler,
"list-prefix-exe-path": cli.ListPrefixExePathHandler,
"list-steam-shortcuts": cli.ListSteamShortcutsHandler,
"list-wine-installed": cli.ListWineInstalledHandler,
"mod-prefix-retina": cli.ModPrefixRetinaHandler,
"serve": cli.ServeHandler,
"set-prefix-env": cli.SetPrefixEnvHandler,
"set-prefix-exe-path": cli.SetPrefixExePathHandler,
"set-vangogh-connection": cli.SetVangoghConnectionHandler,
"remove-downloads": cli.RemoveDownloadsHandler,
"remove-prefix": cli.RemovePrefixHandler,
"remove-steam-shortcut": cli.RemoveSteamShortcutHandler,
"reveal-backups": cli.RevealBackupsHandler,
"reveal-downloads": cli.RevealDownloadsHandler,
"reveal-installed": cli.RevealInstalledHandler,
"reveal-prefix": cli.RevealPrefixHandler,
"reset-vangogh-connection": cli.ResetVangoghConnectionHandler,
"run": cli.RunHandler,
"test-vangogh-connection": cli.TestVangoghConnectionHandler,
"uninstall": cli.UninstallHandler,
"update-wine": cli.UpdateWineHandler,
"validate": cli.ValidateHandler,
"version": cli.VersionHandler,
"wine-install": cli.WineInstallHandler,
"wine-run": cli.WineRunHandler,
"wine-uninstall": cli.WineUninstallHandler,
})
if err := defs.AssertCommandsHaveHandlers(); err != nil {
_ = ns.EndWithError(err)
os.Exit(1)
}
if err := defs.Serve(os.Args[1:]); err != nil {
_ = ns.EndWithError(err)
os.Exit(1)
}
}