Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mechanism to customize each part displayed by showUsage #137

Open
kazupon opened this issue Apr 10, 2024 · 2 comments
Open

Mechanism to customize each part displayed by showUsage #137

kazupon opened this issue Apr 10, 2024 · 2 comments

Comments

@kazupon
Copy link

kazupon commented Apr 10, 2024

If you can make an issue to explain or visually share some screenshot of desired output i can help to improve built-in showUsage usable for rolldown.

Originally posted by @pi0 in #135 (comment)

The showUsage currently provided can be customized with own customized showUsage in runMain, but there is no way to customize the built-in showUsage that citty has.

The showUsage renders the following parts via renderUsage.

  • header (include, command name and versions)
  • usage or sub command
  • options

It would be useful to have a mechanism to custom render each of these parts, so that the logic of showUsage does not have to be reused.

In the rolldown use case, we would like to customize only the header.

@pi0
Copy link
Member

pi0 commented Apr 10, 2024

Hi. Sure we can think of some kind of text AST structure to allow hooking into and modifying the output 👍🏼

In the rolldown use case, we would like to customize only the header.

I want to investigate this first although. Can you share the desired header change? If it is more beautiful, i am up to simply update the default usage to it so not going to the customization path :)

@kazupon
Copy link
Author

kazupon commented Apr 11, 2024

I want to investigate this first although. Can you share the desired header change? If it is more beautiful, i am up to simply update the default usage to it so not going to the customization path :)

@pi0
Thanks!

rolldown header test is here:

rolldown 0.10.1 - Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.

rolldown header image is here:

image

rolldown cli is a layout and color adjustment for the header customization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants