-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
34 lines (27 loc) · 751 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
package main
import (
_ "embed"
"flag"
"github.com/lflare/mdathome-golang/internal/mdathome"
"github.com/sirupsen/logrus"
)
var log *logrus.Logger
func init() {
// Initialise logger
log = logrus.New()
}
func main() {
// Define arguments
printVersion := flag.Bool("version", false, "Prints version of client")
shrinkDatabase := flag.Bool("shrink-database", false, "Shrink cache.db (may take a long time)")
// Parse arguments
flag.Parse()
// Shrink database if flag given, otherwise start server
if *printVersion {
log.Infof("MD@Home Client %s (%d) written in Golang by @lflare", mdathome.ClientVersion, mdathome.ClientSpecification)
} else if *shrinkDatabase {
mdathome.ShrinkDatabase()
} else {
mdathome.StartServer()
}
}