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"
|
||||
)
|
||||
|
||||
// Variables for completion options and functions.
|
||||
var (
|
||||
typeOptions = []string{"bug", "feature", "task"}
|
||||
statusOptions = []string{"open", "closed", "in_progress"}
|
||||
|
||||
@@ -65,6 +65,8 @@ func runCreateCmd(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// runCreateInteractive runs the interactive mode for creating issues,
|
||||
// allowing users to input issue details through a form.
|
||||
func runCreateInteractive() error {
|
||||
form := huh.NewForm(
|
||||
|
||||
@@ -95,7 +97,6 @@ func runCreateInteractive() error {
|
||||
huh.NewOption("2", 2),
|
||||
huh.NewOption("3", 3),
|
||||
huh.NewOption("4", 4),
|
||||
huh.NewOption("5", 5),
|
||||
).Value(&createFlags.priority).Title("Priority"),
|
||||
).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.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().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("status", completionFunc(statusOptions))
|
||||
|
||||
@@ -11,9 +11,11 @@ import (
|
||||
)
|
||||
|
||||
// Variables for delete command flag.
|
||||
var confirmDelete bool
|
||||
var deleteIDs []string
|
||||
var deleteInteractive bool
|
||||
var (
|
||||
confirmDelete bool
|
||||
deleteIDs []string
|
||||
deleteInteractive bool
|
||||
)
|
||||
|
||||
// deleteCmd represents the delete command.
|
||||
var deleteCmd = &cobra.Command{
|
||||
@@ -78,6 +80,8 @@ func runDeleteCmd(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// runDeleteInteractive runs the interactive mode for deleting issues,
|
||||
// allowing users to select multiple issues for deletion.
|
||||
func runDeleteInteractive() error {
|
||||
options := []huh.Option[string]{}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
// Must be called before executing any commands to ensure services are available.
|
||||
var svc *service.Services
|
||||
|
||||
// Flags struct to hold command-line flag values for issues.
|
||||
type Flags struct {
|
||||
interactive bool
|
||||
limit int
|
||||
|
||||
Reference in New Issue
Block a user