-
Notifications
You must be signed in to change notification settings - Fork 6
/
pinecone.go
73 lines (64 loc) · 2.7 KB
/
pinecone.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
package main
import (
"flag"
"fmt"
)
var (
titles TitleList
updateFlag = false
summarizeFlag = false
titleIDFlag = ""
fatxplorer = false
dumpLocation = "dump"
helpFlag = false
version = "0.6.0"
guiEnabled = true
dataPath = "data"
)
func main() {
flag.BoolVar(&updateFlag, "update", false, "Update the JSON data from the source URL")
flag.BoolVar(&updateFlag, "u", false, "Update the JSON data from the source URL")
flag.BoolVar(&summarizeFlag, "summarize", false, "Print summary statistics for all titles")
flag.BoolVar(&summarizeFlag, "s", false, "Print summary statistics for all titles")
flag.StringVar(&titleIDFlag, "titleid", "", "Filter statistics by Title ID")
flag.StringVar(&titleIDFlag, "tID", "", "Filter statistics by Title ID")
flag.BoolVar(&fatxplorer, "fatxplorer", false, "Use FatXplorer's X: drive")
flag.BoolVar(&fatxplorer, "f", false, "Use FatXplorer's X: drive")
flag.StringVar(&dumpLocation, "location", "dump", "Directory to search for TDATA/UDATA directories")
flag.StringVar(&dumpLocation, "l", "dump", "Directory to search for TDATA/UDATA directories")
flag.BoolVar(&helpFlag, "help", false, "Display help information")
flag.BoolVar(&helpFlag, "h", false, "Display help information")
flag.BoolVar(&guiEnabled, "gui", true, "Enable GUI")
flag.BoolVar(&guiEnabled, "g", true, "Enable GUI")
flag.Parse() // Parse command line flags
// Check for help flag
if helpFlag {
fmt.Println("Usage of Pinecone:")
fmt.Println(" -u, --update: Update the JSON data from the source URL. If not set, uses local copies of data.")
fmt.Println(" -s, --summarize: Print summary statistics for all titles. If not set, checks for content in the TDATA folder.")
fmt.Println(" -tID, --titleid: Filter statistics by Title ID (-titleID=ABCD1234). If not set, statistics are computed for all titles.")
fmt.Println(" -f, --fatxplorer: Use FATXPlorer's X drive as the root directory. If not set, runs as normal. (Windows Only)")
fmt.Println(" -l --location: Directory where TDATA/UDATA folders are stored. If not set, checks in \"dump\"")
fmt.Println(" -g, --gui: Enable the GUI interface (default = true)")
fmt.Println(" -h, --help: Display this help information.")
return
}
jsonFilePath := "data/id_database.json"
jsonDataFolder := "data"
jsonURL := "https://api.github.com/repos/MrMilenko/Pinecone/contents/data/id_database.json"
if guiEnabled {
guiOpts := GUIOptions{
DataFolder: jsonDataFolder,
JSONFilePath: jsonFilePath,
JSONUrl: jsonURL,
}
startGUI(guiOpts)
} else {
cliOpts := CLIOptions{
DataFolder: jsonDataFolder,
JSONFilePath: jsonFilePath,
JSONUrl: jsonURL,
}
startCLI(cliOpts)
}
}