| Name | Message | Date |
|---|---|---|
| 📄 ColumnFormatter.cs | 1 month ago | |
| 📄 OutGridTree.cs | 1 month ago | |
| 📄 OutGridTree.csproj | 1 month ago | |
| 📄 OutGridTree.psd1 | 1 month ago | |
| 📄 OutputMode.cs | 1 month ago | |
| 📄 packages.lock.json | 1 month ago |
📄
OutGridTree/ColumnFormatter.cs
using System; using System.Management.Automation; namespace OutGridTree; internal abstract class ColumnFormatter { private ColumnFormatter() { } public static ColumnFormatter FromDisplayEntry(DisplayEntry displayEntry) => displayEntry.ValueType switch { DisplayEntryValueType.Property => new Property(displayEntry.Value), DisplayEntryValueType.ScriptBlock => new Script(ScriptBlock.Create(displayEntry.Value)), _ => throw new ArgumentException( $"Unrecognized {nameof(DisplayEntryValueType)}: {displayEntry.ValueType}.", nameof(displayEntry) ), }; public sealed class Property(string name) : ColumnFormatter { public string Name { get; } = name; } public sealed class Script(ScriptBlock scriptBlock) : ColumnFormatter { public ScriptBlock ScriptBlock { get; } = scriptBlock; } }