-
Notifications
You must be signed in to change notification settings - Fork 37
Update mob and item list functionality #351
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
Conversation
…if no screen information has been received and cast the native uint32 to int as that is the downstream type that is used.
… of a larger refactor
… as well as fixing sort by tolowering the names
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 updates the mob and item list functionalities by centralizing list rendering logic via a new DynamicList function and improving safe access to screen dimensions.
- Introduced a DynamicList function in templates/layout.go for consistent formatted output.
- Updated admin.mob.go and admin.item.go to use DynamicList and case-insensitive sorting.
- Added safe getter methods for screen dimensions in clientsettings.go.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
internal/usercommands/admin.mob.go | Refactored mob list command to use DynamicList and safe screen dimension access. |
internal/usercommands/admin.item.go | Refactored item list command to use DynamicList and improved search handling. |
internal/templates/layout.go | Added DynamicList implementation to centralize dynamic list rendering. |
internal/connections/clientsettings.go | Added default getters for screen width and height for client settings. |
Comments suppressed due to low confidence (1)
internal/usercommands/admin.item.go:75
- [nitpick] Consider renaming 'itmNames' to 'itemList' for clearer consistency with the naming used in the mob list command.
itmNames := []templates.NameDescription{}
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 implements a dynamic list-rendering system for mob and item listing commands and adds safe accessor methods for screen dimensions, along with improved user messaging when no items are found.
- Refactored mob and item list commands to use the new DynamicList function for uniform output formatting.
- Introduced getters for screen width and height with default values in the client settings.
- Added unit tests to verify the behavior of the DynamicList function.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
internal/usercommands/admin.mob.go | Refactored mob list command to use dynamic list rendering and case-insensitive sorting. |
internal/usercommands/admin.item.go | Updated item list command with dynamic list rendering and adjusted filtering behavior. |
internal/templates/layout_test.go | Added tests for the DynamicList function to verify its output handling. |
internal/templates/layout.go | Implemented the DynamicList function to generate formatted, wrapped list output. |
internal/connections/clientsettings.go | Introduced safe accessor methods with sensible defaults for screen dimensions. |
I do realize that the item and mob list functions could be refactored as well as they are doing the same thing but I did not include that in this PR |
Description
This Pull Request introduces a new dynamic list rendering system and applies it to the mob and item listing commands. It also adds safe accessor methods for screen dimensions and improves handling when no items are found.
NOTE: This PR could be followed up with changes to improve
DynamicList
.Changes
DynamicList
function, as part of a larger refactor to centralize list rendering logic.DynamicList
for output generation, and ensured case-insensitive sorting by lowercasing names before comparison.DynamicList