clipboard: ignore Write return value
This commit is contained in:
parent
921f4abbdd
commit
235cecb3eb
4 changed files with 6 additions and 21 deletions
|
|
@ -79,9 +79,7 @@ func newComposer(cfg *config.Config, chat *Model) *composer {
|
|||
SetPlaceholder(tview.NewLine(tview.NewSegment("Select a channel to start chatting", tcell.StyleDefault.Dim(true)))).
|
||||
SetClipboard(
|
||||
func(s string) {
|
||||
if err := clipboard.Write(clipboard.FmtText, []byte(s)); err != nil {
|
||||
slog.Error("failed to write clipboard text", "err", err)
|
||||
}
|
||||
_ = clipboard.Write(clipboard.FmtText, []byte(s))
|
||||
},
|
||||
func() string {
|
||||
return string(clipboard.Read(clipboard.FmtText))
|
||||
|
|
|
|||
|
|
@ -358,9 +358,7 @@ func (gt *guildsTree) yankID() tview.Cmd {
|
|||
// discord.Snowflake (discord.GuildID and discord.ChannelID) have the String method.
|
||||
if id, ok := node.Reference().(fmt.Stringer); ok {
|
||||
return func() tview.Msg {
|
||||
if err := clipboard.Write(clipboard.FmtText, []byte(id.String())); err != nil {
|
||||
slog.Error("failed to copy node id", "err", err)
|
||||
}
|
||||
_ = clipboard.Write(clipboard.FmtText, []byte(id.String()))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1024,9 +1024,7 @@ func (ml *messagesList) yankMessageID() tview.Cmd {
|
|||
}
|
||||
|
||||
return func() tview.Msg {
|
||||
if err := clipboard.Write(clipboard.FmtText, []byte(selectedMessage.ID.String())); err != nil {
|
||||
slog.Error("failed to copy message id", "err", err)
|
||||
}
|
||||
_ = clipboard.Write(clipboard.FmtText, []byte(selectedMessage.ID.String()))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
@ -1038,9 +1036,7 @@ func (ml *messagesList) yankContent() tview.Cmd {
|
|||
}
|
||||
|
||||
return func() tview.Msg {
|
||||
if err := clipboard.Write(clipboard.FmtText, []byte(selectedMessage.Content)); err != nil {
|
||||
slog.Error("failed to copy message content", "err", err)
|
||||
}
|
||||
_ = clipboard.Write(clipboard.FmtText, []byte(selectedMessage.Content))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
@ -1052,9 +1048,7 @@ func (ml *messagesList) yankURL() tview.Cmd {
|
|||
}
|
||||
|
||||
return func() tview.Msg {
|
||||
if err := clipboard.Write(clipboard.FmtText, []byte(selectedMessage.URL())); err != nil {
|
||||
slog.Error("failed to copy message url", "err", err)
|
||||
}
|
||||
_ = clipboard.Write(clipboard.FmtText, []byte(selectedMessage.URL()))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package login
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"github.com/ayn2op/tview"
|
||||
"golang.design/x/clipboard"
|
||||
)
|
||||
|
|
@ -13,10 +11,7 @@ type errMsg struct {
|
|||
|
||||
func setClipboard(content string) tview.Cmd {
|
||||
return func() tview.Msg {
|
||||
if err := clipboard.Write(clipboard.FmtText, []byte(content)); err != nil {
|
||||
slog.Error("failed to copy error message", "err", err)
|
||||
return nil
|
||||
}
|
||||
_ = clipboard.Write(clipboard.FmtText, []byte(content))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue