- Get-NozNote: list notes, filter by -Topic, -Status, -Lang - Get-NozNoteContent: fetch markdown, accepts pipeline input by Slug - Set-NozNote: update note content, accepts markdown from pipeline - New-NozNote: create note with frontmatter template - Remove-NozNote: delete note, ShouldProcess + ConfirmImpact.High for safety - NozNote output object: clean PS-friendly properties (no internal Hash field) - NozCmdletBase: shared config loading, API client lifecycle, error translation - Noz.psd1: module manifest for PS 7.2+ - Install-NozModule.ps1: build + install to user module path - NozCli.Core retargeted to net8.0 for PS 7.4 LTS compatibility
32 lines
1 KiB
C#
32 lines
1 KiB
C#
using System.Management.Automation;
|
|
|
|
namespace Noz.PowerShell.Cmdlets;
|
|
|
|
/// <summary>Get the markdown content of a note.</summary>
|
|
/// <example>
|
|
/// Get-NozNoteContent -Slug psychologie/flow-theorie
|
|
/// "psychologie/flow-theorie" | Get-NozNoteContent
|
|
/// Get-NozNote -Topic psychologie | Get-NozNoteContent | Select-Object Slug, Markdown
|
|
/// </example>
|
|
[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;
|
|
}
|