fix bug where using a issue command in the repl would crash a task

This commit is contained in:
Robin Olsen
2026-02-28 11:39:05 +01:00
parent 8cdaf93f26
commit 697b17e890
3 changed files with 32 additions and 15 deletions

View File

@@ -73,11 +73,32 @@ func init() {
return tasks.NewBacklogRefinementTask(app)
})
// Basic survey commands
surveyCmd.StartCmd.RunE = runStartCmd
surveyCmd.RootCmd.AddCommand(surveyCmd.StartCmd)
surveyCmd.RootCmd.AddCommand(surveyCmd.SubmitCmd)
surveyCmd.RootCmd.AddCommand(surveyCmd.StatusCmd)
surveyCmd.RootCmd.AddCommand(surveyCmd.ListTasksCmd)
surveyCmd.RootCmd.AddCommand(surveyCmd.ListInterfacesCmd)
surveyCmd.RootCmd.AddCommand(issuesCmd.RootCmd)
surveyCmd.RootCmd.AddCommand(surveyCmd.IssuesCmd)
// Issue related commands
surveyCmd.IssuesCmd.AddCommand(issuesCmd.ListCmd)
surveyCmd.IssuesCmd.AddCommand(issuesCmd.CreateCmd)
surveyCmd.IssuesCmd.AddCommand(issuesCmd.UpdateCmd)
surveyCmd.IssuesCmd.AddCommand(issuesCmd.DeleteCmd)
surveyCmd.IssuesCmd.AddCommand(issuesCmd.CloseCmd)
surveyCmd.IssuesCmd.AddCommand(issuesCmd.CommentCmd)
surveyCmd.IssuesCmd.AddCommand(issuesCmd.CommentsCmd)
// Issue commands for the REPL interface
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(issuesCmd.CommentCmd)
issuesCmd.RootCmd.AddCommand(issuesCmd.CommentsCmd)
issuesCmd.RootCmd.AddCommand(surveyCmd.StatusCmd)
}

View File

@@ -0,0 +1,9 @@
package surveyCmd
import "github.com/spf13/cobra"
var IssuesCmd = &cobra.Command{
Use: "issues",
Aliases: []string{"i"},
Short: "Commands related to issues",
}

View File

@@ -7,8 +7,7 @@ import (
"os"
"strings"
"github.com/LazyBachelor/LazyPM/internal/commands/issues"
surveyCmd "github.com/LazyBachelor/LazyPM/internal/commands/survey"
issuesCmd "github.com/LazyBachelor/LazyPM/internal/commands/issues"
"github.com/LazyBachelor/LazyPM/internal/service"
"github.com/LazyBachelor/LazyPM/internal/style"
"github.com/LazyBachelor/LazyPM/pkg/cli"
@@ -142,15 +141,3 @@ func (r *REPL) SetChannels(feedbackChan chan task.ValidationFeedback, quitChan c
r.feedbackChan = feedbackChan
r.quitChan = quitChan
}
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(issuesCmd.CommentCmd)
issuesCmd.RootCmd.AddCommand(issuesCmd.CommentsCmd)
issuesCmd.RootCmd.AddCommand(surveyCmd.StatusCmd)
}