|
|
@@ -1,8 +1,12 @@
|
|
|
package cmd
|
|
|
|
|
|
import (
|
|
|
+ "log"
|
|
|
+
|
|
|
+ "github.com/ayn2op/discordo/internal/constants"
|
|
|
"github.com/gdamore/tcell/v2"
|
|
|
"github.com/rivo/tview"
|
|
|
+ "github.com/zalando/go-keyring"
|
|
|
)
|
|
|
|
|
|
type MainFlex struct {
|
|
|
@@ -50,6 +54,12 @@ func (mf *MainFlex) onInputCapture(event *tcell.EventKey) *tcell.EventKey {
|
|
|
case cfg.Keys.FocusMessageInput:
|
|
|
app.SetFocus(mf.messageInput)
|
|
|
return nil
|
|
|
+ case cfg.Keys.Logout:
|
|
|
+ app.Stop()
|
|
|
+ if err := keyring.Delete(constants.Name, "token"); err != nil {
|
|
|
+ log.Fatal(err)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
case cfg.Keys.ToggleGuildsTree:
|
|
|
// The guilds tree is visible if the numbers of items is two.
|
|
|
if mf.GetItemCount() == 2 {
|