-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for issue.category #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hi! Thanks for the pull request, i will try it out and check if there is any issues Kind regards |
There was a problem hiding this 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.
| func (r *Red_t) SetCategory(id string) { | ||
| r.Config.Category = id |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
| func (r *Red_t) SetCategory(id string) { | |
| r.Config.Category = id | |
| func (r *Red_t) SetCategory(category string) { | |
| r.Config.Category = category |
| 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") |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
| 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") |
| cmd := &cobra.Command{ | ||
| Use: "category", | ||
| Short: "set or get local category", | ||
| Long: "set or get a local category under ~/.red/config.json", |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
| Long: "set or get a local category under ~/.red/config.json", | |
| Long: "set or get a local category under .red/config.json", |
| 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 | ||
| } |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
No description provided.