-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
53 lines (45 loc) · 1.12 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
package main
import (
"fmt"
"github.com/virepri/clipman-desktop/arguments"
"github.com/virepri/clipman-desktop/cli"
"github.com/virepri/clipman-desktop/client"
"github.com/virepri/clipman-desktop/client/internal-command"
"github.com/virepri/clipman-desktop/config"
"github.com/virepri/clipman-desktop/monitor"
"os/user"
)
func main() {
arguments.CheckArgs()
client.SetupChannels()
cli.SetupChannels()
if u, err := user.Current(); err == nil {
config.CfgLocation = u.HomeDir + "/.config/clipman-desktop.cfg"
config.CfgDir = u.HomeDir + "/.config"
} else {
fmt.Println(err.Error())
return
}
if config.LoadCFG() {
if arguments.AutoConnect {
client.Messages <- internal_command.Command{
Cmd: internal_command.CONNECT,
}
if arguments.AutoAuth {
client.Messages <- internal_command.Command{
Cmd: internal_command.AUTH_USER,
}
if arguments.AutoAdmin {
client.Messages <- internal_command.Command{
Cmd: internal_command.AUTH_ADMIN,
}
}
}
}
}
config.WaitGroup.Add(3)
go monitor.StartMonitor()
go client.StartClient()
go cli.StartCLI()
config.WaitGroup.Wait()
}