citty icon indicating copy to clipboard operation
citty copied to clipboard

Feat: Class based usage rendering

Open tkjaergaard opened this issue 1 year ago โ€ข 0 comments

๐Ÿ”— #117

โœจ Feature

  • [ ] ๐Ÿ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality like performance)
  • [x] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

This PR is somewhat a protoype in relation to feature request #117 concerning the ability to easily extending the generation of usage output.

The current implementation is a single function that returns a string. If a user want to alter the output they have to implement the renderUsage function and make alternations. This is fragile to new updates in core implementation and makes the developer reImplement a lot of the utils functions like resolveValue, resolveArgs and formatLineColumns.

This PR allows to simply extend the RenderUsage class and override the methods they want to alter. Alternatively the can create their own class with a custom "template".

Again, it's a foundation to from where we can discuss direction and relevance ๐Ÿ™‚

๐Ÿ“ Checklist

  • [x] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

tkjaergaard avatar Jan 29 '24 11:01 tkjaergaard