Skip to content

Commit

Permalink
Can we strip colors out?
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Oct 23, 2024
1 parent c21a354 commit 75dbc89
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions generator/CSharpReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using NuGet.Common;
using NuGet.Packaging;

Expand Down Expand Up @@ -327,6 +328,7 @@ static string[] GetCommandsFromHelp(string stdout)
.Where(l => !l.StartsWith(" "))
.Select(l => l.Trim())
.Select(l => l.Substring(0, l.IndexOf(" ")))
.Select(l => Regex.Replace(l, @"[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]", ""))
.ToArray();

Console.WriteLine("Commands: ");
Expand Down

0 comments on commit 75dbc89

Please sign in to comment.