-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (39 loc) · 999 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"bit-agent/bitwarden"
"bit-agent/environment/installation"
"bit-agent/ssh"
"bit-agent/util/cli"
"flag"
)
var version = "dev"
func main() {
var installFlag = flag.Bool("install", false, "Install bit-agent on the system.")
flag.Parse()
cli.Text(cli.Logo(version))
if *installFlag {
install()
return
}
run()
}
func run() {
cli.Section("Authentication")
session := bitwarden.Authenticate()
cli.Success("The authentication was successfully completed.")
cli.Section("Sync thread startup")
bitwarden.StartSync(session)
cli.Success("The sync thread has been started.")
cli.Section("Key(s) retrieving")
folder := bitwarden.RetrieveSshFolder(session)
keys := bitwarden.RetrieveSshKeys(session, folder)
cli.Success("The key(s) has been successully loaded.")
cli.Section("Agent setup")
ssh.StartAgent(keys)
cli.Success("The agent has been successfully started.")
select {}
}
func install() {
cli.Section("Installation")
installation.Install()
}