using System.Management.Automation; namespace Noz.PowerShell.Cmdlets; /// Get the markdown content of a note. /// /// Get-NozNoteContent -Slug psychologie/flow-theorie /// "psychologie/flow-theorie" | Get-NozNoteContent /// Get-NozNote -Topic psychologie | Get-NozNoteContent | Select-Object Slug, Markdown /// [Cmdlet(VerbsCommon.Get, "NozNoteContent")] [OutputType(typeof(NozNoteContent))] public sealed class GetNozNoteContentCmdlet : NozCmdletBase { [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] public string Slug { get; set; } = ""; protected override void ProcessRecord() { var content = Run(Api.GetNoteAsync(Slug)); WriteObject(new NozNoteContent { Slug = content.Slug, Markdown = content.Markdown }); } } public sealed class NozNoteContent { public string Slug { get; init; } = ""; public string Markdown { get; init; } = ""; public override string ToString() => Slug; }