restructure project following best practices
https://go.dev/doc/modules/layout This also enables us to later import just the db interaction part say to the gemini capsule backend go project.
This commit is contained in:
parent
928c82536f
commit
360fedbebe
11 changed files with 202 additions and 169 deletions
39
internal/ui/commands.go
Normal file
39
internal/ui/commands.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
gemlog "git.travisshears.com/travisshears/gemlog-cli/gemlog"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
func DeleteGemlogCMD(config *gemlog.Config, id string, rev string) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
err := gemlog.DeleteGemlogEntry(config, id, rev)
|
||||
if err != nil {
|
||||
return ErrorMsg{err}
|
||||
}
|
||||
|
||||
return Notification(fmt.Sprintf("Gemlog with id: %s deleted", id))
|
||||
}
|
||||
}
|
||||
|
||||
func LoadGemlogCMD(config *gemlog.Config, id string) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
log, err := gemlog.ReadGemlogEntry(config, id)
|
||||
if err != nil {
|
||||
return ErrorMsg{err}
|
||||
}
|
||||
return GemLogLoaded{Log: log}
|
||||
}
|
||||
}
|
||||
|
||||
func LoadGemlogsCMD(config *gemlog.Config) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
logs, err := gemlog.ListGemLogs(config)
|
||||
if err != nil {
|
||||
return ErrorMsg{err}
|
||||
}
|
||||
return GemLogsLoaded{Logs: logs}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue