refactor to decouple commands form entrypoint for reusability and centralizing commands.

Increase reusability and composition
This commit is contained in:
Robin Olsen
2026-02-22 19:46:55 +01:00
parent 118e67dbf4
commit 33c8c05ae3
28 changed files with 305 additions and 282 deletions

View File

@@ -3,12 +3,24 @@ package main
import (
"context"
issuesCmd "github.com/LazyBachelor/LazyPM/internal/commands/issues"
surveyCmd "github.com/LazyBachelor/LazyPM/internal/commands/survey"
"github.com/LazyBachelor/LazyPM/internal/service"
"github.com/LazyBachelor/LazyPM/pkg/cli"
)
func main() {
if err := cli.NewCli().Run(context.Background(), service.BaseConfig); err != nil {
if err := cli.NewCli(issuesCmd.RootCmd).Run(context.Background(), service.BaseConfig); err != nil {
return
}
}
func init() {
issuesCmd.RootCmd.AddCommand(issuesCmd.GetCmd)
issuesCmd.RootCmd.AddCommand(issuesCmd.ListCmd)
issuesCmd.RootCmd.AddCommand(issuesCmd.CloseCmd)
issuesCmd.RootCmd.AddCommand(issuesCmd.CreateCmd)
issuesCmd.RootCmd.AddCommand(issuesCmd.DeleteCmd)
issuesCmd.RootCmd.AddCommand(issuesCmd.UpdateCmd)
issuesCmd.RootCmd.AddCommand(surveyCmd.StatusCmd)
}