-
Notifications
You must be signed in to change notification settings - Fork 20
/
mosesacs.go
39 lines (32 loc) · 896 Bytes
/
mosesacs.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
package main
import (
"flag"
"fmt"
"github.com/lucacervasio/mosesacs/cli"
"github.com/lucacervasio/mosesacs/daemon"
"os"
)
func main() {
port := flag.Int("p", 9292, "Daemon port to listen on")
flDaemon := flag.Bool("d", false, "Enable daemon mode")
flVersion := flag.Bool("v", false, "Version")
flHelp := flag.Bool("h", false, "Help")
flUrl := flag.String("u", "localhost:9292", "Url to connect")
flXmppUser := flag.String("xmpp-user", "", "Xmpp Username")
flXmppPassword := flag.String("xmpp-pass", "", "Xmpp Password")
flag.Parse()
fmt.Printf("MosesACS %s by Luca Cervasio <[email protected]> (C)2014-2016 http://mosesacs.org\n", daemon.Version)
if *flVersion {
os.Exit(0)
}
if *flHelp {
flag.Usage()
os.Exit(0)
}
if *flDaemon {
logger := daemon.BasicWriter{}
daemon.Run(port, &logger, *flXmppUser, *flXmppPassword)
} else {
client.Run(*flUrl)
}
}