-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
65 lines (56 loc) · 1.26 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
package main
import (
"fmt"
"os"
"strings"
"github.com/dixonwille/wmenu"
"github.com/xackery/eqcleanup/client"
"github.com/xackery/eqcleanup/internal/core"
"github.com/xackery/eqcleanup/internal/era"
)
// Version of eqcleanup
var Version = "1.0"
func main() {
err := run()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
os.Exit(0)
}
func run() (err error) {
fmt.Println("Welcome to EQ Cleanup", Version, "https://github.com/xackery/eqcleanup")
fmt.Println("This tool will MODIFY your database. Please back up before doing any operation.")
fmt.Println("---")
c, err := client.New()
if err != nil {
return
}
Menu(c)
return
}
// Menu is the main menu of eqclient
func Menu(c *client.Client) (err error) {
ok := true
menu := wmenu.NewMenu("Choose a category")
menu.Option("Era - Out of era cleanup", c, false, era.Menu)
menu.Option("Core - Administrative overhauls", c, false, core.Menu)
//menu.Option("Misc - Misc edits, ex. disabling rainfall", nil, false, misc.Menu)
menu.Option("Exit", nil, false, func(opt wmenu.Opt) error {
ok = false
fmt.Println("Have a nice day!")
return nil
})
for ok {
err = menu.Run()
if err == nil {
continue
}
if strings.Contains(err.Error(), "Invalid") {
err = nil
continue
}
return
}
return
}