Compare commits

...

4 Commits

Author SHA1 Message Date
decentral1se f8039aec33
fix: no empty input & error out on chat in status buffer
continuous-integration/drone/push Build is passing Details
2023-12-29 20:04:49 +01:00
decentral1se eaed66df6b
docs: capitalise 2023-12-29 20:04:39 +01:00
decentral1se 7e0fa5a0c7
docs: no fullstops to match convention elsewhere 2023-12-29 20:04:16 +01:00
decentral1se 837d1b91ac
docs: package doc strings 2023-12-29 20:04:06 +01:00
2 changed files with 15 additions and 5 deletions

View File

@ -1,4 +1,4 @@
// main is the command-line entrypoint.
// Package main is the command-line entrypoint.
package main
import (

View File

@ -1,3 +1,4 @@
// Package ui is responsible for all things user interface.
package ui
import (
@ -28,8 +29,8 @@ var (
Metadata resistant messaging
%s
Run /start for the getting started guide.
Run /help to see all available commands.`
Run /start for the getting started guide
Run /help to see all available commands`
gettingStartedMessage = `=====================
Getting started guide
@ -94,7 +95,7 @@ func NewModel(username, homeDir, version string, debug bool) model { // nolint:r
input.Prompt = "> "
input.PromptStyle = inputPromptStyle
input.Cursor.SetMode(cursor.CursorStatic)
input.Placeholder = "enter commands here..."
input.Placeholder = "Enter commands here..."
input.TextStyle = inputTextStyle
input.Focus()
@ -239,9 +240,18 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case "enter":
cmdInput := m.input.Value()
if len(cmdInput) == 0 || string(cmdInput[0]) != "/" {
if len(cmdInput) == 0 {
break
}
if string(cmdInput[0]) != "/" && m.menuState == 0 {
cmds = append(cmds, func() tea.Msg {
errMsg := "Woops, this is not a chat buffer. Only commands are allowed"
return cmdMsg{output: []string{errMsg}}
})
break
}
cmds = append(cmds, func() tea.Msg {
return handleCommand(cmdInput[1:], m.hiddenInput)
})