Skip to content

Commit

Permalink
Merge pull request #22 from santisq/17-improve-indent-extension-metho…
Browse files Browse the repository at this point in the history
…d-efficiency

improving Indent extension method
  • Loading branch information
santisq committed Sep 12, 2023
2 parents 548d543 + 9cc42dc commit 63987e8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/PSTree/PSTreeExtensions.cs
@@ -1,13 +1,23 @@
using System.Text.RegularExpressions;
using System.Text;
using System.Text.RegularExpressions;

namespace PSTree;

internal static class PSTreeExtensions
{
private static readonly Regex s_re = new(@"└|\S", RegexOptions.Compiled);

internal static string Indent(this string inputString, int indentation) =>
new string(' ', (4 * indentation) - 4) + "└── " + inputString;
private static readonly StringBuilder s_sb = new();

internal static string Indent(this string inputString, int indentation)
{
s_sb.Clear();

return s_sb.Append(' ', (4 * indentation) - 4)
.Append("└── ")
.Append(inputString)
.ToString();
}

internal static PSTreeFileSystemInfo[] ConvertToTree(
this PSTreeFileSystemInfo[] inputObject)
Expand Down

0 comments on commit 63987e8

Please sign in to comment.