-
Notifications
You must be signed in to change notification settings - Fork 4
/
cmd-config.go
53 lines (40 loc) · 1.84 KB
/
cmd-config.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 slackoverflow
import (
"strconv"
"github.com/aframevr/slackoverflow/std"
)
// slackoverflow config
// Display configuration information
type cmdConfig struct{}
func (a *cmdConfig) Execute(args []string) error {
// Refresh the session before running this command and make sure that Slack Overflow is configured
slackoverflow.SessionRefresh(false)
selfConfig := std.NewTable("SlackOverflow Configuration", " ")
selfConfig.AddRow("Log Level", slackoverflow.config.SlackOverflow.LogLevel)
selfConfig.AddRow("Number of Questions to watch", strconv.Itoa(slackoverflow.config.SlackOverflow.Watch))
selfConfig.Print()
si := std.NewTable("Session Info", " ")
si.AddRow("Project path", slackoverflow.projectPath)
si.AddRow("Config file", slackoverflow.configFile)
si.AddRow("Database file", slackoverflow.databaseFile)
si.AddRow("Current working dir", slackoverflow.cwd)
si.AddRow("Hostname", slackoverflow.hostname)
si.AddRow("Userame", slackoverflow.user.Username)
si.AddRow("Name", slackoverflow.user.Name)
si.AddRow("User ID", slackoverflow.user.Uid)
si.AddRow("Group ID", slackoverflow.user.Gid)
si.Print()
slack := std.NewTable("Slack Configuration", " ")
slack.AddRow("API host", slackoverflow.config.Slack.APIHost)
slack.AddRow("Token", slackoverflow.config.Slack.Token)
slack.AddRow("Channel", slackoverflow.config.Slack.Channel)
slack.Print()
stackexchange := std.NewTable("StackExchange Configuration", " ")
stackexchange.AddRow("API Host", slackoverflow.config.StackExchange.APIHost)
stackexchange.AddRow("API Version", slackoverflow.config.StackExchange.APIVersion)
stackexchange.AddRow("Key", slackoverflow.config.StackExchange.Key)
stackexchange.AddRow("Site", slackoverflow.config.StackExchange.Site)
stackexchange.AddRow("Tagged", slackoverflow.config.StackExchange.SearchAdvanced["tagged"])
stackexchange.Print()
return nil
}