This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

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

writer TextWriter
nodes IReadOnlyList<T>
label Func<T, string>
children Func<T, IReadOnlyList<T>>
maxDepth int

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)
; }