Skip to content

Conversation

@klement
Copy link

@klement klement commented Nov 7, 2025

No description provided.

@MrJeffLarry MrJeffLarry added the enhancement New feature or request label Dec 12, 2025
@MrJeffLarry MrJeffLarry self-requested a review December 12, 2025 11:11
@MrJeffLarry MrJeffLarry added this to the v0.2.0 milestone Dec 12, 2025
@MrJeffLarry
Copy link
Owner

Hi!

Thanks for the pull request, i will try it out and check if there is any issues

Kind regards
Jeff

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for issue categories in the Redmine CLI tool, allowing users to view, create, and edit issues with category assignments. Categories are project-specific organizational units in Redmine that help classify issues.

  • Adds category configuration fields (Category and CategoryID) to store both global and local category settings
  • Implements API integration to fetch and display categories for issues
  • Provides CLI commands for managing category configuration at both global and local levels

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/config/config.go Adds Category and CategoryID configuration fields, getters/setters, and persistence logic
internal/cmd/issue/view.go Adds category display field to issue view output
internal/cmd/issue/structs.go Adds FIELD_CATEGORY constant and Category field to issue struct
internal/cmd/issue/edit.go Adds category selection functionality to issue edit workflow; fixes typo in assignee error message
internal/cmd/issue/create.go Adds category selection option to issue creation workflow
internal/cmd/global/structs.go Defines issueCategory and issueCategories structs for API responses
internal/cmd/global/helpers.go Implements GetCategories function to fetch categories from Redmine API
internal/cmd/config/category.go Implements CLI commands for setting global and local category configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +112 to +113
func (r *Red_t) SetCategory(id string) {
r.Config.Category = id
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name 'id' is misleading - it should be 'category' or 'name' since this setter accepts a string value for the category name, not an ID. The CategoryID is set separately via SetCategoryID. This is inconsistent with the parallel function SetProject which correctly names its string parameter 'id' but actually stores a project name.

Suggested change
func (r *Red_t) SetCategory(id string) {
r.Config.Category = id
func (r *Red_t) SetCategory(category string) {
r.Config.Category = category

Copilot uses AI. Check for mistakes.
var err error

if id, err = strconv.Atoi(cmd.Flags().Arg(0)); err != nil {
print.Error("ID is not an valid number, please use `category set 1` for category id 1")
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message contains grammatical error 'an valid' which should be 'a valid'. The article 'an' is incorrectly used before a consonant sound.

Suggested change
print.Error("ID is not an valid number, please use `category set 1` for category id 1")
print.Error("ID is not a valid number, please use `category set 1` for category id 1")

Copilot uses AI. Check for mistakes.
cmd := &cobra.Command{
Use: "category",
Short: "set or get local category",
Long: "set or get a local category under ~/.red/config.json",
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description incorrectly states the config file location as '/.red/config.json' when it should be '.red/config.json' (without the tilde) for local category configuration. The tilde prefix (/) indicates a home directory path, which is used for global config, not local config.

Suggested change
Long: "set or get a local category under ~/.red/config.json",
Long: "set or get a local category under .red/config.json",

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +85
func localCategory(r *config.Red_t) *cobra.Command {
cmd := &cobra.Command{
Use: "category",
Short: "set or get local category",
Long: "set or get a local category under ~/.red/config.json",
}
cmd.AddCommand(setLocalCategory(r))
return cmd
}

func globalCategory(r *config.Red_t) *cobra.Command {
cmd := &cobra.Command{
Use: "category",
Short: "set or get global category",
Long: "set or get a global category under ~/.red/config.json",
}
cmd.AddCommand(setGlobalCategory(r))
return cmd
}
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The localCategory and globalCategory functions are defined but never registered with the config command structure. These functions need to be added to the configLocal and configGlobal functions in config.go (similar to how localProject and globalProject are registered) for the category commands to be accessible to users.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants