From 431f9e4f5d1969da300e70d0df22ff51b3e81803 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Mon, 9 Feb 2026 19:13:46 +0100 Subject: [PATCH] add comments to fuctions. make sure priority ranges form 0-4 --- pkg/cli/commands/completion.go | 1 + pkg/cli/commands/create.go | 5 +++-- pkg/cli/commands/delete.go | 10 +++++++--- pkg/cli/commands/root.go | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/cli/commands/completion.go b/pkg/cli/commands/completion.go index af34c20..77d3fcf 100644 --- a/pkg/cli/commands/completion.go +++ b/pkg/cli/commands/completion.go @@ -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"} diff --git a/pkg/cli/commands/create.go b/pkg/cli/commands/create.go index 95e9d53..84504db 100644 --- a/pkg/cli/commands/create.go +++ b/pkg/cli/commands/create.go @@ -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)) diff --git a/pkg/cli/commands/delete.go b/pkg/cli/commands/delete.go index 4884464..a684e53 100644 --- a/pkg/cli/commands/delete.go +++ b/pkg/cli/commands/delete.go @@ -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]{} diff --git a/pkg/cli/commands/root.go b/pkg/cli/commands/root.go index 2115fc1..9e18856 100644 --- a/pkg/cli/commands/root.go +++ b/pkg/cli/commands/root.go @@ -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