📄 OutGridTree/OutGridTree.cs
using System.Management.Automation;
using System.Management.Automation.Internal;

namespace OutGridTree;

[Cmdlet(VerbsData.Out, "GridTree")]
[Alias("ogt")]
public sealed class OutGridTree : Cmdlet
{
    [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)]
    public PSObject InputObject { get; set; } = AutomationNull.Value;

    protected override void BeginProcessing()
    {
        // TODO: Open window
    }

    protected override void ProcessRecord()
    {
        // TODO: Add record to window
        WriteDebug($"Processing record: {InputObject}");
    }

    protected override void EndProcessing()
    {
        // TODO: Wait for window to close
        WriteDebug("End processing");
        WriteDebug("Exited");
    }

    protected override void StopProcessing()
    {
        // TODO: Close window
        WriteDebug("Stop processing");
        WriteDebug("Shutdown");
    }
}