Skip to content

Conversation

@DarkPhoenix42
Copy link
Contributor

No description provided.

@DarkPhoenix42 DarkPhoenix42 requested a review from Copilot May 14, 2025 18:52
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 colorized output and improves logging/configuration throughout the codebase while also updating client–server interaction interfaces.

  • Updates the client and server modules to use new color helper functions for user prompts and responses.
  • Refactors client handler interfaces and associated tests to support the new API signature.
  • Enhances logging and argument parsing in both client and server main functions.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unittests/server/server_connection_manager_test.cpp Updated mock client handler and test client connection handling.
src/server/server.cpp Added logging and updated server initialization for colorized output.
src/server/main.cpp Redesigned argument parsing and signal handling with improved logging.
src/server/connection_manager.cpp Refactored client handler usage and connection handling logic.
src/server/client_info.cpp Added file system tree support with proper mutex protection.
src/server/CMakeLists.txt Updated build configuration to include new client_info.
src/common/logging.cpp Updated configure_logging to accept a logger name.
src/client/response_manager.cpp Integrated colorized responses and additional debug logging.
src/client/main.cpp Updated logging initialization in the client main.
src/client/interface.cpp Modified prompt output to include colors and improve UX.
src/client/connection_manager.cpp Added debug logging for received encrypted data.
src/client/client.cpp Updated response handling and introduced a debug print.
include/server/server.hpp Added documentation and adjusted member types for logging.
include/server/request_manager.hpp Updated client handler interface and added colorized docs.
include/server/connection_manager.hpp Switched from ClientHandler to IClientHandler for consistency.
include/server/client_info.hpp Introduced file system tree and enhanced ClientInfo structure.
include/common/logging.hpp Updated logging API declarations.
include/client/response_manager.hpp Added an explicit constructor for logger name support.
include/client/colors.hpp New header defining ANSI color codes and helper functions.
Comments suppressed due to low confidence (1)

src/client/client.cpp:134

  • The debug print statement left in production code may be unintended; consider removing it or replacing it with a proper logging call.
std::cout << "response success" << std::endl;

Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com>
…for enabling/disabling colors

Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com>
…formatting

Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com>
…formatting

Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com>
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 introduces colorized output for user prompts and responses, enhancing the visual feedback both in the CLI and in test logs. Key changes include:

  • Integrating ANSI color codes into output messages (success, error, info, warnings) in both client and response manager.
  • Updating unit and integration tests to disable colors for reliable text comparisons.
  • Adding new colors support files (colors.hpp and colors.cpp) and updating CMake files accordingly.

Reviewed Changes

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

Show a summary per file
File Description
tests/unittests/client/client_response_manager_test.cpp Added color disable/enable in test fixtures for plain text.
tests/unittests/client/client_integration_test.cpp Updated tests to include colors; adjusted output assertions.
src/client/response_manager.cpp Introduced colorized formatting in responses and helper outputs.
src/client/interface.cpp Updated CLI prompts and output messages with color codes.
src/client/client.cpp Modified connection success message to include colors.
src/client/colors.cpp & include/client/colors.hpp New files providing ANSI color escape code wrappers.
src/client/CMakeLists.txt Updated to compile the new colors.cpp file.

size_str = size_stream.str();

// Apply appropriate color based on file size if colors are enabled
if (colors::use_colors) {
Copy link

Copilot AI May 14, 2025

Choose a reason for hiding this comment

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

[nitpick] The file size formatting logic with color codes is repeated in several branches; consider extracting this pattern into a helper function to reduce duplication and improve readability.

Copilot uses AI. Check for mistakes.
Comment on lines +273 to +277
size_t pos = desc.find('(');
if (pos != std::string::npos &&
desc.find(')', pos) != std::string::npos) {
arg_part = desc.substr(pos);
desc = desc.substr(0, pos - 1); // -1 to remove trailing space
Copy link

Copilot AI May 14, 2025

Choose a reason for hiding this comment

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

[nitpick] The approach for splitting command descriptions into the base text and argument parts feels a bit complex and could be made more robust; consider refactoring this logic to better handle unexpected formatting.

Suggested change
size_t pos = desc.find('(');
if (pos != std::string::npos &&
desc.find(')', pos) != std::string::npos) {
arg_part = desc.substr(pos);
desc = desc.substr(0, pos - 1); // -1 to remove trailing space
std::regex desc_regex(R"((.*?)(\s*\(.*\))?)");
std::smatch match;
if (std::regex_match(desc, match, desc_regex)) {
desc = match[1].str(); // Base text
arg_part = match[2].str(); // Argument part (if any)

Copilot uses AI. Check for mistakes.
@v1bh475u v1bh475u linked an issue May 14, 2025 that may be closed by this pull request
@v1bh475u v1bh475u merged commit 6c4fde8 into std-fenris:main May 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Color and Banner Definitions

2 participants