forked from grundleborg/slack-advanced-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
69 lines (61 loc) · 1.76 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
package main
import (
"os"
"gopkg.in/urfave/cli.v1"
)
func main() {
app := cli.NewApp()
app.Name = "Slack Advanced Exporter"
app.Usage = "A tool to augment official Slack data exports with additional data that Slack does not include by default."
app.Version = "0.2.0"
var inputArchive string
var outputArchive string
var slackApiToken string
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "input-archive, i",
Value: "",
Usage: "The path to the Slack export archive which you wish to augment.",
Destination: &inputArchive,
},
cli.StringFlag{
Name: "output-archive, o",
Value: "",
Usage: "The path to which you would like the output archive to be written.",
Destination: &outputArchive,
},
}
app.Commands = []cli.Command{
{
Name: "fetch-attachments",
Aliases: []string{"a"},
Usage: "Fetch all file attachments and add them to the output archive.",
Action: func(c *cli.Context) error {
return fetchAttachments(inputArchive, outputArchive, slackApiToken)
},
Flags: []cli.Flag{
cli.StringFlag{
Name: "api-token",
Usage: "Slack API token. Can be obtained here: https://api.slack.com/docs/oauth-test-tokens",
Destination: &slackApiToken,
},
},
},
{
Name: "fetch-emails",
Aliases: nil,
Usage: "Fetch users' e-mail addresses using Slack API and them to the output archive.",
Action: func(c *cli.Context) error {
return fetchEmails(inputArchive, outputArchive, slackApiToken)
},
Flags: []cli.Flag{
cli.StringFlag{
Name: "api-token",
Usage: "Slack API token. Can be obtained here: https://api.slack.com/docs/oauth-test-tokens",
Destination: &slackApiToken,
},
},
},
}
app.Run(os.Args)
}