Skip to content

Commit

Permalink
improving Indent extension method
Browse files Browse the repository at this point in the history
  • Loading branch information
santisq committed Sep 11, 2023
1 parent 548d543 commit 9cc42dc
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/PSTree/PSTreeExtensions.cs
Original file line number Diff line number Diff line change
@@ -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 9cc42dc

Please sign in to comment.