-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
135 lines (128 loc) · 2.56 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package main
import (
"os"
"github.com/codegangsta/cli"
"github.com/sirupsen/logrus"
)
var (
logger *logrus.Logger
)
func init() {
logger = logrus.New()
logger.Level = logrus.DebugLevel
logger.Out = os.Stdout
}
func main() {
app := cli.NewApp()
app.Name = "twitter-graph"
app.Usage = "A docker log pump to splunk"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "host, d",
Usage: "Neo4j host",
EnvVar: "NEO4_HOST",
Value: "localhost",
},
cli.IntFlag{
Name: "port, P",
Usage: "Neo4j port",
EnvVar: "NEO4_PORT",
Value: 7474,
},
cli.StringFlag{
Name: "user, u",
Usage: "Neo4j username",
EnvVar: "NEO4_USERNAME",
},
cli.StringFlag{
Name: "password, p",
Usage: "Neo4j password",
EnvVar: "NEO4_PASSWORD",
},
cli.StringFlag{
Name: "screenname, s",
Usage: "Twitter screen name",
},
cli.StringFlag{
Name: "user-key",
Usage: "Twitter User Key",
EnvVar: "TWITTER_USER_KEY",
},
cli.StringFlag{
Name: "user-secret",
Usage: "Twitter User Secret",
EnvVar: "TWITTER_USER_SECRET",
},
cli.StringFlag{
Name: "consumer-key",
Usage: "Twitter Consumer Key",
EnvVar: "TWITTER_CONSUMER_KEY",
},
cli.StringFlag{
Name: "consumer-secret",
Usage: "Twitter Consumer Secret",
EnvVar: "TWITTER_CONSUMER_SECRET",
},
}
app.Commands = []cli.Command{
cli.Command{
Name: "add",
Subcommands: []cli.Command{
cli.Command{
Name: "followers",
Action: func(ctx *cli.Context) {
exec(ctx, func(eng *Engine) error {
return eng.AddFollowers()
})
},
},
cli.Command{
Name: "mentions",
Action: func(ctx *cli.Context) {
exec(ctx, func(eng *Engine) error {
return eng.AddMentions()
})
},
},
cli.Command{
Name: "tweets",
Action: func(ctx *cli.Context) {
exec(ctx, func(eng *Engine) error {
return eng.AddTweets()
})
},
},
},
},
cli.Command{
Name: "maintain",
Subcommands: []cli.Command{
cli.Command{
Name: "users",
Action: func(ctx *cli.Context) {
exec(ctx, func(eng *Engine) error {
return eng.CompleteUsers()
})
},
},
cli.Command{
Name: "following",
Action: func(ctx *cli.Context) {
exec(ctx, func(eng *Engine) error {
return eng.MaintainFollowing()
})
},
},
cli.Command{
Name: "followers",
Action: func(ctx *cli.Context) {
exec(ctx, func(eng *Engine) error {
return eng.MaintainFollowers()
})
},
},
},
},
}
app.Run(os.Args)
}