refactor(cmd): add package comment

This commit is contained in:
ayn2op 2025-06-23 22:29:21 -04:00
parent 635ac36786
commit 01bcf54f0c
3 changed files with 8 additions and 11 deletions

View file

@ -29,7 +29,6 @@ func newGuildsTree(cfg *config.Config) *guildsTree {
}
gt.Box = ui.ConfigureBox(gt.Box, &cfg.Theme)
gt.
SetRoot(tview.NewTreeNode("")).
SetTopLevel(1).

View file

@ -416,7 +416,7 @@ func (mt *messagesText) open() {
go openURL(msg.Attachments[0].URL)
}
} else {
mt.showUrlSelector(urls, msg.Attachments)
mt.showAttachmentsList(urls, msg.Attachments)
}
}
@ -443,19 +443,15 @@ func extractURLs(content string) []string {
return urls
}
func (mt *messagesText) showUrlSelector(urls []string, attachments []discord.Attachment) {
done := func() {
app.pages.RemovePage(attachmentsListPageName).SwitchToPage(flexPageName)
app.SetFocus(mt)
}
func (mt *messagesText) showAttachmentsList(urls []string, attachments []discord.Attachment) {
list := tview.NewList().
SetWrapAround(true).
SetHighlightFullLine(true).
ShowSecondaryText(false).
SetDoneFunc(done)
list.Box = ui.ConfigureBox(list.Box, &mt.cfg.Theme)
SetDoneFunc(func() {
app.pages.RemovePage(attachmentsListPageName).SwitchToPage(flexPageName)
app.SetFocus(mt)
})
list.
SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
switch event.Name() {
@ -471,6 +467,7 @@ func (mt *messagesText) showUrlSelector(urls []string, attachments []discord.Att
return event
})
list.Box = ui.ConfigureBox(list.Box, &mt.cfg.Theme)
for i, a := range attachments {
list.AddItem(a.Filename, "", rune('a'+i), func() {

View file

@ -1,3 +1,4 @@
// Package cmd defines the command-line interface commands
package cmd
import (