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

Prototype style hooks #2262

Closed
wants to merge 26 commits into from

Conversation

shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented Oct 7, 2024

This is built on top of #2251 to add simple text style hooks. The style hooks do not get passed enough to do complex coloring, but this allows adding color without needing to subclass Help and Command.

program.usage(
  `${styleText('green', '[options]')} ${styleText('yellow', '[command]')}`,
);
program.configureHelp({
  styleTitle: (str) => styleText('bold', str),
  styleDescription: (str) => styleText('magenta', str),
  styleItemDescription: (str) => styleText('italic', str),
  styleOptionTerm: (str) => styleText('green', str),
  styleSubcommandTerm: (str) => styleText('yellow', str),
});
style-output

@shadowspawn
Copy link
Collaborator Author

Lot of simple hooks, but I think it makes simple styling much easier for author. I am going to do some more work in this direction to try and have matching colours in "usage" transparently.

@shadowspawn
Copy link
Collaborator Author

Closing as merged into #2251.
Prototype went well!

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

Successfully merging this pull request may close these issues.

1 participant