ccase
ccase copied to clipboard
Fix stdin reading bug and upgrade to convert_case 0.8 from 0.6
This PR addresses multiple issues and enhancements related to CLI behavior and library compatibility:
🐛 Bug Fix
- Fixes [#2](https://github.com/rutrum/ccase/issues/2): Correctly detects when
stdinis piped, allowing input fallback to work reliably in all environments.
🚀 Upgrade
- Upgrades
convert_casefrom 0.6 to 0.8, which introduces API-breaking changes:- The
Patternenum was removed. -
Casenow usesCase<'a>withCustomas a structured variant. - Boundary handling API changed slightly.
- The
🛠️ Refactor
- Introduces
UserCaseandUserPatternenums as intermediaries:- Provides a stable internal abstraction over
convert_casechanges - Uses
strummacros to support:- CLI parsing via
EnumString - Help output via
DisplayandVariantNames - Iteration via
EnumIter
- CLI parsing via
- Provides a stable internal abstraction over
- CLI help output now mirrors the original style with aligned and styled case/pattern listings.
✅ Tests
- Made the previously ignored test
input_requiredrunnable using an environment flag - Added new tests for:
- Invalid case and pattern inputs (e.g.,
SNEK,SENT) - Pattern application with custom delimiter (
-p camel -d ++) - Help output includes all expected cases and patterns
- Input args override stdin when both are present
- Invalid case and pattern inputs (e.g.,
📌 Compatibility
- Maintains backwards-compatible CLI behavior for all existing options
- Prepares for future enhancements by decoupling internal representation from upstream API