Merge remote-tracking branch 'origin/main' into LPM-52
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"log"
|
||||
|
||||
"github.com/Dicklesworthstone/beads_viewer/pkg/model"
|
||||
"github.com/Dicklesworthstone/beads_viewer/pkg/ui"
|
||||
"github.com/LazyBachelor/LazyPM/internal/service"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config := service.Config{
|
||||
StatisticsStoragePath: "./.pm/stats.json",
|
||||
BeadsDBPath: "./.pm/db.db",
|
||||
IssuePrefix: "pm",
|
||||
}
|
||||
|
||||
svc, close, err := service.NewServices(context.Background(), config)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer close()
|
||||
|
||||
beadsIssues, err := svc.Beads.AllIssues(context.Background())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
modelIssues := make([]model.Issue, 0, len(beadsIssues))
|
||||
for _, issue := range beadsIssues {
|
||||
jsonData, err := json.Marshal(issue)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var modelIssue model.Issue
|
||||
if err := json.Unmarshal(jsonData, &modelIssue); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
modelIssues = append(modelIssues, modelIssue)
|
||||
}
|
||||
|
||||
model := ui.NewModel(modelIssues, nil, config.BeadsDBPath)
|
||||
|
||||
if err := tea.NewProgram(model, tea.WithAltScreen(),
|
||||
tea.WithMouseAllMotion()); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func main() {
|
||||
err = web.Run(ctx, config)
|
||||
case "tui":
|
||||
fmt.Println("Starting TUI Interface...")
|
||||
err = tui.Run(ctx, config)
|
||||
_, err = tui.Run(ctx, config)
|
||||
default:
|
||||
fmt.Println("Invalid selection. Exiting.")
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ func main() {
|
||||
IssuePrefix: "pm",
|
||||
}
|
||||
|
||||
if err := tui.Run(context.Background(), config); err != nil {
|
||||
if _, err := tui.Run(context.Background(), config); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user