Previous to PowerShell 7.1, it would have been uncommon for a cmdlet to receive input decorated with ANSI escape sequences. But support for ANSI was added in 7.1 (see https://github.com/PowerShell/PowerShell/issues/13071).
This PR adds a single line of code, a RegEx, to strip ANSI escape sequences from the input text.
This PR is a draft because
a) A regex is probably not the most robust way to strip ANSI. Apparently PS has a built-in capability (StringDecorated) but that is internal.
b) Pulling in all of Regex is overkill probably
c) I'm not 100% certain that TypeGetter.cs is the right place to do the stripping.
This PR Fixes #131
Previous to PowerShell 7.1, it would have been uncommon for a cmdlet to receive input decorated with ANSI escape sequences. But support for ANSI was added in 7.1 (see https://github.com/PowerShell/PowerShell/issues/13071).
This PR adds a single line of code, a RegEx, to strip ANSI escape sequences from the input text.
This PR is a draft because
a) A regex is probably not the most robust way to strip ANSI. Apparently PS has a built-in capability (
StringDecorated
) but that is internal. b) Pulling in all of Regex is overkill probably c) I'm not 100% certain thatTypeGetter.cs
is the right place to do the stripping.Comments appreciated.