-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: Restructure CLI module and improve flag management #10
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactored the CLI module to enhance the management of command-line flags. Introduced new structures for better memory handling and added functions for creating and freeing CLI application states. Updated Makefile to streamline the build process for the new CLI utilities. - Improved memory management for flag states - Simplified flag addition logic in CLI applications - Updated Makefile to reflect new dependencies and build targets
Implemented a new function to generate help text for the CLI application, providing users with version information, descriptions, usage instructions, and available options. This enhances user experience by making the CLI more informative and user-friendly.
Refactored the CLI module to enhance flag management and ensure safer memory handling. Added checks for potential overflow and invalid states during flag initialization. Improved comments for clarity and maintainability.
Added checks for null pointers and potential overflow conditions in flag management functions to improve robustness. This ensures safer memory operations and prevents unexpected behavior during CLI application execution.
…atting Refactored flag capacity management to prevent overflow during allocation. Enhanced help text generation by ensuring valid flag names and appending default values and environment variables. Updated formatting for better alignment and readability in CLI help output.
Refactored comments in the CLI header file to enhance clarity and maintain consistency in terminology. Adjusted descriptions to follow a uniform style, improving readability for future developers.
Refactored the help text generation in the CLI module to enhance clarity and consistency. Adjusted the formatting of the help output to ensure proper spacing and alignment. Added new test cases to validate the help text for various flag configurations, improving overall test coverage and reliability.
Enhanced comments in the CLI module to provide clearer explanations of function behaviors and return values. This improves code readability and assists future developers in understanding the API's usage and error handling.
… handling Refactored the CLI application state structure to include arguments management alongside flags. Improved memory handling in flag state functions, ensuring proper allocation and deallocation. Updated help text generation to utilize a new formatted string function for better readability and maintainability.
Implemented improvements to flag management and parsing logic, allowing for better handling of flag values from different sources (default, environment, CLI). Added new functions for parsing command-line arguments and managing flag states, enhancing the overall robustness of the CLI application. Updated tests to ensure correct functionality and added error handling for invalid inputs.
Refactored the argument parsing logic to enhance error handling and memory management. Updated the parsing result structure to ensure proper resource management and added detailed comments for clarity. Improved handling of duplicate flags and missing values, ensuring robust CLI behavior.
Implemented dynamic handling of environment variables in flag management to allow runtime changes. This enhances the flexibility of the CLI application by enabling flags to reference environment variables that can be modified without recompilation. Updated tests to verify the new functionality and ensure robust error handling.
Enhanced memory handling in CLI application by ensuring proper allocation and deallocation of resources. Added checks to prevent buffer overflows and invalid inputs, improving overall stability and reliability. This refactor addresses potential memory leaks and enhances error handling for command-line arguments.
Enhanced memory management in the CLI module by ensuring proper deallocation of environment variables and string lists. Improved input validation to prevent potential crashes and memory leaks. This refactor aims to increase the robustness and reliability of the CLI application.
Refactored the Makefile to update the path for the CLI test binary and reorganized the structure for better clarity. The CLI test source file has been moved to a new directory, ensuring a more organized project layout. Additionally, the HTTP check binary build rule was repositioned for consistency in the build process.
Refactored the argument parsing logic in the CLI application to enhance clarity and maintainability. Improved error messages for missing or invalid flag values, ensuring better user feedback. Removed redundant code and streamlined the handling of command-line arguments.
Improved the flag management logic by adding overflow checks to prevent potential memory issues during flag addition. Updated error handling for allocation failures to ensure robustness. Reset count on allocation failure to maintain consistent state.
…w checks Added a helper function for case-insensitive string comparison to enhance boolean value parsing. Improved overflow checks in argument handling to prevent potential buffer overflows. This enhances the robustness and reliability of the CLI application.
Refactored the argument parsing error message generation to use a NULL-terminated string array instead of formatted strings. This change improves memory management and simplifies the code by eliminating the need for variable argument lists. Enhanced error handling for various parsing scenarios to ensure robustness.
Updated command parsing constants to use a more descriptive prefix, enhancing code readability and maintainability. This change ensures consistency across the CLI module and improves understanding of the maximum argument limits.
Added support for dynamic environment variable handling and improved command-line argument parsing. This enhancement allows for better flexibility in managing flags and improves error handling for missing or invalid inputs. Updated the Makefile to include the new library dependency for CLI functionality.
…ndling Enhanced the Makefile by adding flags to optimize binary size and improve error handling in the PID check application. Introduced new strip and link flags to reduce the final binary size and ensure better memory management. Updated error messages in the source code for clarity and consistency.
Implemented the portcheck feature in the CLI application to allow users to check the accessibility of specified ports. This addition enhances the utility of the application by providing a lightweight tool for network diagnostics. Updated the Makefile to include the new portcheck binary and integrated corresponding tests to ensure functionality.
Removed unnecessary comment in the portcheck function to improve code clarity and maintainability. This change ensures that the code is cleaner and easier to read without affecting functionality.
Added checks for interruption in network-related functions to ensure graceful handling of user interruptions. This prevents potential resource leaks and improves the robustness of the port checking functionality. - Implemented interruption checks before and after blocking calls - Ensured sockets are closed properly on interruption - Enhanced user feedback for interrupted operations
… process Updated the Makefile to link the CLI library in the build process for the parallel application. This change ensures that the application can utilize the CLI functionalities effectively. Additionally, improved error handling during the build process to enhance reliability.
Refactored the job management system in the CLI application by removing the job limiting feature and associated code. Updated the Makefile to enforce C99 standard compliance and improved the build process. This change enhances code clarity and reduces complexity by eliminating unnecessary components.
Introduced a new command parsing module to enhance the CLI application. This includes the implementation of command string parsing functionality, allowing for better handling of user input. The Makefile has been updated to build the command module and its associated tests, improving the overall structure and maintainability of the project. - Added command.h for command parsing definitions - Created command_parse.c for parsing logic - Updated Makefile to include command module in builds and tests - Integrated command_test.c for unit testing command parsing functionality
Updated the Makefile to include the compilation of the new HTTP module and its static library. This change enhances the build process by integrating the HTTP functionality into the CLI application, allowing for better HTTP request handling and testing capabilities.
…anagement Refactored the HTTP request handling code to enhance clarity and maintainability. Removed unused functions and consolidated error handling for better readability. Introduced new functions for creating HTTP headers, including Basic Authentication and User-Agent headers, to streamline header management. Improved the parsing of HTTP response status codes to ensure robustness against malformed responses. - Consolidated error handling in HTTP request functions - Added functions for creating Basic Auth and User-Agent headers - Enhanced status code parsing for better error detection - Removed deprecated and unused code for clarity
Added timeout management to the HTTP request process, improving error handling for connection timeouts. Introduced new error codes and messages to provide clearer feedback on request failures. This change enhances the robustness of the HTTP client by ensuring it can handle slow or unresponsive servers more gracefully.
…rt checks Enhanced error messages for non-existent processes in pidcheck and added detailed error reporting for inaccessible ports in portcheck. These changes improve user feedback and debugging capabilities when running checks.
Revised the README to enhance the clarity of command-line options and their environment variable mappings. Improved descriptions for HTTP method, User-Agent, timeout, and other parameters to ensure users understand their usage and defaults. This update aims to provide better guidance for users configuring the application.
Updated the job count variable to size_t for better memory handling and to prevent potential overflow issues. Adjusted related loops and memory allocation to ensure consistency and correctness across the codebase.
Eliminated obsolete HTTP status code definitions and a redundant validation function to streamline the codebase. This cleanup enhances readability and maintainability by removing unnecessary elements.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Major refactoring to extract shared libraries and improve code organization across all microcheck tools.
Structure Changes
src/→apps/lib/:lib/cli/- Unified CLI framework with flag parsing, help generation, env var integrationlib/command/- Command string parsing with quote handlinglib/http/- HTTP utilities (URL parsing, headers, base64, request/response)test/→tests/feature/+tests/unit/CLI Framework
[$ENV_VAR]syntaxBuild
Before/After