AsciiTreeWriter Pennington.Cli
Renders a hierarchy as an ASCII tree (├─ └─ │) to a TextWriter.
Methods
Write<T>
#public static void Write<T>(TextWriter writer, IReadOnlyList<T> nodes, Func<T, string> label, Func<T, IReadOnlyList<T>> children, int maxDepth = 2147483647)
Writes nodes as a tree. label formats one node to a single line; children yields a node's children. Recurses until maxDepth (1-based; the top level is depth 1).
Parameters
writerTextWriternodesIReadOnlyList<T>labelFunc<T, string>childrenFunc<T, IReadOnlyList<T>>maxDepthint
Pennington.Cli.AsciiTreeWriter
namespace Pennington.Cli;
/// Renders a hierarchy as an ASCII tree (├─ └─ │) to a TextWriter.
public class AsciiTreeWriter
{
/// Writes nodes as a tree. label formats one node to a single line; children yields a node's children. Recurses until maxDepth (1-based; the top level is depth 1).
public static void Write<T>(TextWriter writer, IReadOnlyList<T> nodes, Func<T, string> label, Func<T, IReadOnlyList<T>> children, int maxDepth = 2147483647)
;
}