refactor to use app package instead of service
refactor app to be composable
This commit is contained in:
@@ -44,6 +44,6 @@ func executePMCommand(input string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
output, err := issuesCmd.ExecuteArgsString(parts)
|
||||
output, err := issues.ExecuteArgsString(parts)
|
||||
return output, err
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
issuesCmd "github.com/LazyBachelor/LazyPM/internal/commands/issues"
|
||||
"github.com/LazyBachelor/LazyPM/internal/app"
|
||||
issues "github.com/LazyBachelor/LazyPM/internal/commands/issues"
|
||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||
"github.com/LazyBachelor/LazyPM/internal/service"
|
||||
"github.com/LazyBachelor/LazyPM/internal/style"
|
||||
"github.com/LazyBachelor/LazyPM/pkg/cli"
|
||||
"github.com/LazyBachelor/LazyPM/pkg/task"
|
||||
@@ -54,14 +54,14 @@ func (r *REPL) Run(ctx context.Context, config cli.Config) error {
|
||||
defer term.Restore(int(os.Stdin.Fd()), oldState)
|
||||
|
||||
// Initialize services for beads, config and stats.
|
||||
app, cleanup, err := service.NewApp(ctx, config)
|
||||
app, cleanup, err := app.New(ctx, config)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to initialize services: %w", err)
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
// Make sure to set app, to ensure they are available.
|
||||
issuesCmd.SetApp(app)
|
||||
issues.SetApp(app)
|
||||
|
||||
// Store app reference for updating feedback
|
||||
r.app = app
|
||||
|
||||
@@ -162,7 +162,7 @@ func issueIDSuggestions(partial string, hasCommand bool) []prompt.Suggest {
|
||||
return nil
|
||||
}
|
||||
|
||||
issues, _ := issuesCmd.GetIssueCompletions(context.Background(), partial)
|
||||
issues, _ := issues.GetIssueCompletions(context.Background(), partial)
|
||||
|
||||
var suggestions []prompt.Suggest
|
||||
for _, issue := range issues {
|
||||
|
||||
Reference in New Issue
Block a user