noz-cli/Noz.PowerShell/Cmdlets/FindNozNoteCmdlet.cs
kryptomrx f45b31defa feat: graph and search API client with PS analysis cmdlets
Get-NozGraph, Find-NozNote, Measure-NozGarden, Set-NozNoteStatus,
Get-NozOrphans — graph edges, Meilisearch search, garden stats,
frontmatter status patch, orphan detection from inbound link analysis.
2026-05-17 00:27:45 +02:00

35 lines
891 B
C#

using System.Management.Automation;
namespace Noz.PowerShell.Cmdlets;
[Cmdlet(VerbsCommon.Find, "NozNote")]
[OutputType(typeof(NozSearchHit))]
public sealed class FindNozNoteCmdlet : NozCmdletBase
{
[Parameter(Mandatory = true, Position = 0)]
public string Query { get; set; } = "";
[Parameter]
public string? Topic { get; set; }
[Parameter]
public int Limit { get; set; } = 20;
protected override void ProcessRecord()
{
var hits = Run(Api.SearchAsync(Query, Topic, Limit));
foreach (var h in hits)
{
WriteObject(new NozSearchHit
{
Slug = h.Slug,
Title = h.Title,
Description = h.Description,
Topic = h.Topic,
Status = h.Status,
Lang = h.Lang,
});
}
}
}