mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-08-13 14:27:27 +00:00
Fix unused and ineffectual variables (#32)
This commit is contained in:
parent
9c2886c9b8
commit
beba7dc388
4 changed files with 51 additions and 5 deletions
37
plugins/hello/hello.go
Normal file
37
plugins/hello/hello.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package hello
|
||||
|
||||
import (
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/profullstack/agentbbs/internal/auth"
|
||||
"github.com/profullstack/agentbbs/internal/plugin"
|
||||
"github.com/profullstack/agentbbs/internal/ui"
|
||||
)
|
||||
|
||||
type Plugin struct{}
|
||||
|
||||
func (Plugin) ID() string { return "hello" }
|
||||
func (Plugin) Title() string { return "Hello World" }
|
||||
func (Plugin) Description() string { return "A simple hello world plugin by Milla-Agent" }
|
||||
func (Plugin) RequiresAuth() bool { return false }
|
||||
|
||||
func (Plugin) New(user auth.User, _ plugin.Context) tea.Model {
|
||||
return model{}
|
||||
}
|
||||
|
||||
type model struct{}
|
||||
|
||||
func (m model) Init() tea.Cmd { return nil }
|
||||
|
||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
if k, ok := msg.(tea.KeyMsg); ok {
|
||||
switch k.String() {
|
||||
case "esc", "q", "enter", "ctrl+c", " ":
|
||||
return m, plugin.Exit
|
||||
}
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (m model) View() string {
|
||||
return ui.Frame.Render("Hello from Milla-Agent!\nThis is a simple module submission.\n\nPress 'q' or 'esc' to exit.")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue