add config and bruno
This commit is contained in:
parent
8ceb698f03
commit
472c1b36a7
9 changed files with 708 additions and 7 deletions
15
main.go
15
main.go
|
|
@ -29,15 +29,20 @@ var mainCommands = map[Action]tea.Cmd{
|
|||
}
|
||||
|
||||
type model struct {
|
||||
// ui state
|
||||
notification string
|
||||
cursor int
|
||||
actions []Action
|
||||
errorTxt string
|
||||
|
||||
// deps
|
||||
config *gemlog.Config
|
||||
}
|
||||
|
||||
func initialModel() model {
|
||||
func initialModel(config *gemlog.Config) model {
|
||||
return model{
|
||||
actions: []Action{Write, Read, Edit, Delete},
|
||||
config: config,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +99,13 @@ func (m model) View() string {
|
|||
}
|
||||
|
||||
func main() {
|
||||
p := tea.NewProgram(initialModel())
|
||||
config, err := gemlog.LoadConfig()
|
||||
if err != nil {
|
||||
fmt.Printf("Error loading config: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
p := tea.NewProgram(initialModel(config))
|
||||
if _, err := p.Run(); err != nil {
|
||||
fmt.Printf("Alas, there's been an error: %v", err)
|
||||
os.Exit(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue