unjs / citty

πŸŒ† Elegant CLI Builder
Other
729 stars 23 forks source link

Feat: Class based usage rendering #119

Open tkjaergaard opened 7 months ago

tkjaergaard commented 7 months ago

πŸ”— #117

✨ Feature

πŸ“š 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