Moreorless is a thin Python wrapper around `difflib.unified_diff` designed to simplify its usage and address common edge cases, such as the "No newline at eof" issue. It provides a more user-friendly interface for generating unified diffs, applying patches, and producing colorized diff output. The current version is 0.5.0, with an irregular release cadence based on contributions and feature enhancements.
pip install moreorlessVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to generate a raw unified diff string using `unified_diff` and how to print a colorized diff to the console using `echo_color_unified_diff`. The `filename` arguments are used in the diff header.
Consult Python's `difflib` documentation for advanced use cases or deep customization.
Ensure your terminal supports ANSI escape codes for colorized output. If you only need the diff string, use `unified_diff` directly which does not involve `click`'s output formatting.
Consider contributing to the project or opening issues for bugs/feature requests to help drive development. For enterprise-grade needs, evaluate its fit carefully.
Upgrade to `moreorless>=0.5.0` to use the combined diff feature.
Install the package using pip: `pip install moreorless`
Ensure the patch string is a valid unified diff format and corresponds accurately to the changes between the original and modified content. Verify the integrity and correctness of the patch content.
Review the function's signature and provide all necessary arguments. For 'unified_diff', ensure you provide 'astr' (original string), 'bstr' (new string), and 'filename' (source filename for context).