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

Feature: theming support for list of subcommand aliases #152

Merged
merged 3 commits into from
May 15, 2023

Conversation

janluke
Copy link
Owner

@janluke janluke commented Apr 23, 2023

This PR adds two new styles to HelpTheme which affects a Group subcommands definition list:

  • alias: color of a subcommand alias names
  • alias_secondary: color of separator (comma) and parenthesis in subcommand alias lists.

If alias_secondary is not provided, alias style is used.

This PR changes the dark theme so that aliases are shown in "yellow" (col1 is bright yellow) and alias_secondary is just normal white.

Closes #151.


Old, previous iteration

This PR adds three styles to HelpTheme:

  • alias: color of alias
  • alias_list_sep: color of alias separators (i.e. "," by default)
  • alias_list_boundaries: color of eventual characters "wrapping" the list of alias (i.e. parenthesis by default).

The last two might not be specified. In such case:

  • col1 will be used for alias_list_sep
  • whatever is used for alias_list_sep will be used for boundaries (i.e. alias_list_sep or col1).

Remember you can always use override Command.format_subcommand_aliases to customize how aliases are formatted.

@wabiloo

@janluke janluke mentioned this pull request Apr 23, 2023
Copy link

@wabiloo wabiloo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@janluke
Copy link
Owner Author

janluke commented May 15, 2023

I replaced the three styles with just two: alias and alias_secondary. I refactored and added some simple test. I also updated the dark theme to use these new two styles.

@janluke janluke merged commit 97ad6d4 into master May 15, 2023
@janluke janluke added the enhancement New feature or request label May 15, 2023
@janluke janluke deleted the alias-list-styles branch May 15, 2023 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Styling of aliases
2 participants