using System.Management.Automation;
namespace Noz.PowerShell.Cmdlets;
/// Delete a note from the server.
///
/// Remove-NozNote -Slug psychologie/alte-notiz
/// Get-NozNote -Status seed | Where-Object Topic -eq "draft" | Remove-NozNote -WhatIf
/// Get-NozNote -Status seed | Where-Object Topic -eq "draft" | Remove-NozNote -Confirm:$false
///
[Cmdlet(VerbsCommon.Remove, "NozNote", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High)]
public sealed class RemoveNozNoteCmdlet : NozCmdletBase
{
[Parameter(Mandatory = true, Position = 0,
ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
public string Slug { get; set; } = "";
protected override void ProcessRecord()
{
if (!ShouldProcess(Slug, "Delete note")) return;
Run(Api.DeleteNoteAsync(Slug));
WriteVerbose($"Deleted: {Slug}");
}
}