add comments to fuctions.
make sure priority ranges form 0-4
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Variables for completion options and functions.
|
||||||
var (
|
var (
|
||||||
typeOptions = []string{"bug", "feature", "task"}
|
typeOptions = []string{"bug", "feature", "task"}
|
||||||
statusOptions = []string{"open", "closed", "in_progress"}
|
statusOptions = []string{"open", "closed", "in_progress"}
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ func runCreateCmd(cmd *cobra.Command, args []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// runCreateInteractive runs the interactive mode for creating issues,
|
||||||
|
// allowing users to input issue details through a form.
|
||||||
func runCreateInteractive() error {
|
func runCreateInteractive() error {
|
||||||
form := huh.NewForm(
|
form := huh.NewForm(
|
||||||
|
|
||||||
@@ -95,7 +97,6 @@ func runCreateInteractive() error {
|
|||||||
huh.NewOption("2", 2),
|
huh.NewOption("2", 2),
|
||||||
huh.NewOption("3", 3),
|
huh.NewOption("3", 3),
|
||||||
huh.NewOption("4", 4),
|
huh.NewOption("4", 4),
|
||||||
huh.NewOption("5", 5),
|
|
||||||
).Value(&createFlags.priority).Title("Priority"),
|
).Value(&createFlags.priority).Title("Priority"),
|
||||||
).Title("Create New Issue").WithTheme(huh.ThemeBase()),
|
).Title("Create New Issue").WithTheme(huh.ThemeBase()),
|
||||||
)
|
)
|
||||||
@@ -109,7 +110,7 @@ func init() {
|
|||||||
createCmd.Flags().StringVarP(&createFlags.description, "desc", "d", "", "Issue description")
|
createCmd.Flags().StringVarP(&createFlags.description, "desc", "d", "", "Issue description")
|
||||||
createCmd.Flags().StringVarP(&createFlags.status, "status", "s", "open", "Issue status(open, closed, in_progress)")
|
createCmd.Flags().StringVarP(&createFlags.status, "status", "s", "open", "Issue status(open, closed, in_progress)")
|
||||||
createCmd.Flags().StringVarP(&createFlags.issueType, "type", "t", "task", "Issue type(bug, feature, task)")
|
createCmd.Flags().StringVarP(&createFlags.issueType, "type", "t", "task", "Issue type(bug, feature, task)")
|
||||||
createCmd.Flags().IntVarP(&createFlags.priority, "priority", "p", 0, "Issue priority(0-5)")
|
createCmd.Flags().IntVarP(&createFlags.priority, "priority", "p", 0, "Issue priority(0-4)")
|
||||||
|
|
||||||
createCmd.RegisterFlagCompletionFunc("type", completionFunc(typeOptions))
|
createCmd.RegisterFlagCompletionFunc("type", completionFunc(typeOptions))
|
||||||
createCmd.RegisterFlagCompletionFunc("status", completionFunc(statusOptions))
|
createCmd.RegisterFlagCompletionFunc("status", completionFunc(statusOptions))
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Variables for delete command flag.
|
// Variables for delete command flag.
|
||||||
var confirmDelete bool
|
var (
|
||||||
var deleteIDs []string
|
confirmDelete bool
|
||||||
var deleteInteractive bool
|
deleteIDs []string
|
||||||
|
deleteInteractive bool
|
||||||
|
)
|
||||||
|
|
||||||
// deleteCmd represents the delete command.
|
// deleteCmd represents the delete command.
|
||||||
var deleteCmd = &cobra.Command{
|
var deleteCmd = &cobra.Command{
|
||||||
@@ -78,6 +80,8 @@ func runDeleteCmd(cmd *cobra.Command, args []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// runDeleteInteractive runs the interactive mode for deleting issues,
|
||||||
|
// allowing users to select multiple issues for deletion.
|
||||||
func runDeleteInteractive() error {
|
func runDeleteInteractive() error {
|
||||||
options := []huh.Option[string]{}
|
options := []huh.Option[string]{}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
// Must be called before executing any commands to ensure services are available.
|
// Must be called before executing any commands to ensure services are available.
|
||||||
var svc *service.Services
|
var svc *service.Services
|
||||||
|
|
||||||
|
// Flags struct to hold command-line flag values for issues.
|
||||||
type Flags struct {
|
type Flags struct {
|
||||||
interactive bool
|
interactive bool
|
||||||
limit int
|
limit int
|
||||||
|
|||||||
Reference in New Issue
Block a user