Relocate global variable declarations

This commit is contained in:
ayntgl 2021-10-15 23:36:00 +04:00
parent 1aefedfaec
commit 8ea53c88a5
4 changed files with 15 additions and 13 deletions

View file

@ -11,8 +11,6 @@ const userAgent = "" +
"AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/92.0.4515.131 Safari/537.36"
var conf *config
type keybindingsChannelsTree struct {
Focus string
}

View file

@ -12,11 +12,6 @@ import (
"github.com/rivo/tview"
)
var (
session *discordgo.Session
selectedChannel *discordgo.Channel
selectedMessage int
)
var (
boldRegex = regexp.MustCompile(`(?m)\*\*(.*?)\*\*`)
italicRegex = regexp.MustCompile(`(?m)\*(.*?)\*`)

13
main.go
View file

@ -1,6 +1,7 @@
package main
import (
"github.com/ayntgl/discordgo"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/zalando/go-keyring"
@ -8,6 +9,18 @@ import (
const service = "discordo"
var (
app *tview.Application
loginForm *tview.Form
channelsTree *tview.TreeView
messagesView *tview.TextView
messageInputField *tview.InputField
mainFlex *tview.Flex
conf *config
session *discordgo.Session
)
func main() {
conf = loadConfig()

8
ui.go
View file

@ -10,12 +10,8 @@ import (
)
var (
app *tview.Application
loginForm *tview.Form
channelsTree *tview.TreeView
messagesView *tview.TextView
messageInputField *tview.InputField
mainFlex *tview.Flex
selectedChannel *discordgo.Channel
selectedMessage int
)
func newApp() *tview.Application {