Adds theme package for better color management. Fixes invalid Go version. by scalvert · Pull Request #4 · gleanwork/glean-cli

Summary

This pull request includes several significant changes to the cmd/chat.go and cmd/search.go files to improve the code structure, remove unused imports, and enhance the chat and search functionalities. The changes include refactoring functions, modifying imports, and updating templates for better readability and maintainability.

Chat command improvements:

  • Removed unused imports and added a new import for theme in cmd/chat.go.
  • Introduced a new ChatState struct to hold the state for processing chat responses, improving the organization of state management.
  • Refactored the executeChat function to separate the chat request sending (sendChatRequest) and response processing (processChatResponse) into distinct functions. [1] [2] [3]
  • Replaced the greenCheck function with theme.Blue for consistent theming in chat stage formatting.

Search command improvements:

  • Removed unused imports and added a new import for theme in cmd/search.go.
  • Updated the default template for search results to use theme functions for consistent styling. [1] [2]
  • Simplified the runSearch function by removing unnecessary comments and organizing flag handling and options setting. [1] [2] [3] [4]
  • Replaced inline color functions with theme.TemplateFuncs to centralize color handling and improve maintainability.

General improvements:

  • Removed unused dependencies from go.mod to clean up the project dependencies.