-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (40 loc) · 841 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
package main
import (
// "gonum.org/v1/plot/vg/draw"
// "gonum.org/v1/plot/vg/vgsvg"
// "gonum.org/v1/plot/vg/vgeps"
"log"
"os"
com "github.com/0x0f0f0f/tripbot9000/commands"
gen "github.com/0x0f0f0f/tripbot9000/generator"
gli "github.com/0x0f0f0f/tripbot9000/glitcher"
// "strings"
)
func main() {
cmds := []com.Command{
gen.NewGemstoneCommand(),
gen.NewMandelbrotCommand(),
gen.NewMandelgemCommand(),
gli.NewMatrixCommand(),
}
args := os.Args[1:]
if len(args) < 1 {
log.Fatal("You must pass a subcommand") //TODO print usage
}
subcmd := args[0]
for _, cmd := range cmds {
if cmd.Name() == subcmd {
err := cmd.Init(args[1:])
if err != nil {
panic(err)
}
err = cmd.Run()
if err != nil {
panic(err)
}
return
}
}
// TODO print usage
log.Fatal("Subcommand not found")
}