refactor: handle slash commands in a separate function

* quit gorc when "/quit" is sent
* move tea commands into their own package
* other small fixes
This commit is contained in:
2022-01-24 04:23:02 +02:00
parent e34cc39e63
commit 913e76f9db
11 changed files with 161 additions and 133 deletions
+2 -1
View File
@@ -23,6 +23,7 @@ import (
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/illusionman1212/gorc/cmds"
"github.com/illusionman1212/gorc/ui"
)
@@ -79,7 +80,7 @@ func (s State) Update(msg tea.Msg) (State, tea.Cmd) {
case " ", "enter":
// run the newClient cmd when pressing "enter" while focused on the connect button
if key == "enter" && s.FocusIndex == len(s.Inputs)+1 {
return s, connect
return s, cmds.Connect
}
// toggle tls state when pressing "enter" or "space" while focused on the checkbox