-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
57 lines (39 loc) · 868 Bytes
/
Copy pathmain.go
File metadata and controls
57 lines (39 loc) · 868 Bytes
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
package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/sskender/jargonlsp/server"
)
const (
LOG_FILE_PATH = "debug.log"
)
func main() {
// TODO logging is bad
logFile, err := os.OpenFile(LOG_FILE_PATH, os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
panic(err)
}
defer logFile.Close()
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
log.SetOutput(logFile)
// flags
showVersion := flag.Bool("version", false, "Show version")
dictionaryPath := flag.String("dictionary", "", "Dictionary file")
flag.Parse()
// server
settings := server.ServerSettings{
DictionaryPath: *dictionaryPath,
EnableTcp: false,
}
jargon := server.New(settings)
if *showVersion {
version := jargon.Version()
fmt.Println(version)
return
}
jargon.RunLoop()
// TODO proper exit from all routines
log.Println("exiting gracefully")
}