This pull request addresses a few key changes (See more #24) and significantly improves the code structure and testability of clipper.
Key Changes:
Package Renaming: The main package has been renamed from main to clipper for better clarity and consistency.
Interfaces:
Introduced ContentReader and ClipboardWriter interfaces to improve flexibility and allow for different content sources and clipboard implementations.
This change makes the code more modular and easier to test.
Options Handling:
Created a dedicated options package to centralize command-line argument parsing and configuration management.
This improves code organization and maintainability.
Dependency Injection: The Run function now accepts a ClipboardWriter as a parameter, enabling easier mocking in tests.
Test Suite:
Added comprehensive unit tests for the clipper package to ensure the correctness of file reading, clipboard writing, and content parsing logic.
The tests use helper functions for creating temporary files and managing standard input, improving test readability. See more #17 and #19
Additional Changes:
Removed the old main.go and main_test.go files, as their functionality has been migrated to the new structure.
Benefits:
Improved code organization and readability.
Enhanced testability through the use of interfaces and dependency injection.
Increased flexibility for future extensions and integrations.
Resolves #24
How to Test:
Checkout this branch.
Run the tests using go test ./.... All tests should pass.
Run the clipper tool with different options and input sources to verify correct behavior.
Screenshots/GIFs (optional):
You could include screenshots or GIFs demonstrating the updated test coverage or any visual changes in the output.
Checklist:
[x] All unit tests pass.
[x] The clipper tool functions as expected with various options and input sources.
[x] The code is well-documented and adheres to the project's coding style.
Additional Notes:
This pull request is a major step towards a more modular, testable, and maintainable codebase for the clipper tool. It sets the foundation for future enhancements and features.
This pull request addresses a few key changes (See more #24) and significantly improves the code structure and testability of
clipper
.Key Changes:
main
toclipper
for better clarity and consistency.ContentReader
andClipboardWriter
interfaces to improve flexibility and allow for different content sources and clipboard implementations.options
package to centralize command-line argument parsing and configuration management.Run
function now accepts aClipboardWriter
as a parameter, enabling easier mocking in tests.clipper
package to ensure the correctness of file reading, clipboard writing, and content parsing logic.Additional Changes:
main.go
andmain_test.go
files, as their functionality has been migrated to the new structure.Benefits:
Resolves #24
How to Test:
go test ./...
. All tests should pass.Screenshots/GIFs (optional):
Checklist:
Additional Notes:
This pull request is a major step towards a more modular, testable, and maintainable codebase for the
clipper
tool. It sets the foundation for future enhancements and features.