Skip to content

add support to ignore ansi sequences when formatting usage display. Fixes #879 #880

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timmaffett
Copy link

This PR adds logic to exclude hidden ANSI escape sequences when formatting the Usage display.
The ANSI escape sequences are excluded when calculating the lengths of help strings used in the Usage display by using a string extension lengthWithoutAnsi which removes any hidden ANSI escape sequences present before calculating the string length.

It includes tests of the lengthWithoutAnsi getter to ensure that it returns correct length values when no ANSI escape sequences are present as well as when a variety of ANSI escape sequences are present.

(The regex that i am using here is well exercised, as it is the same reg ex that I use within VS Code when parsing and formatting ANSI sequences within the debug console)


  • [X ] I’ve reviewed the contributor guide and applied the relevant portions to this PR.

@timmaffett timmaffett requested a review from munificent as a code owner April 16, 2025 21:38
@munificent munificent removed their request for review April 24, 2025 17:20
@munificent
Copy link
Member

Sorry, but I definitely don't have time right now to maintain args. :(

@timmaffett
Copy link
Author

Understandable - I'm excited for whatever you are working on 😄

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

Successfully merging this pull request may close these issues.

2 participants