Compare commits
4 Commits
ee80ef2c67
...
f8039aec33
Author | SHA1 | Date |
---|---|---|
decentral1se | f8039aec33 | |
decentral1se | eaed66df6b | |
decentral1se | 7e0fa5a0c7 | |
decentral1se | 837d1b91ac |
|
@ -1,4 +1,4 @@
|
|||
// main is the command-line entrypoint.
|
||||
// Package main is the command-line entrypoint.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
18
ui/model.go
18
ui/model.go
|
@ -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)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue