noz-cli/Noz.PowerShell/Cmdlets/GetNozTemplateCmdlet.cs
kryptomrx 58410f8d9f feat: link and templates commands with note linking helper
NoteLinkHelper inserts wikilinks into an existing 'Siehe auch' section
or appends one. ApplyPlaceholders fills {{title}}/{{date}}/{{topic}} in
template bodies. new --template <name> fetches a server-side template
before opening the editor. SlugGuard moved to NozCli.Core in a previous
session — remove stale copy from NozCli.
2026-05-17 00:28:22 +02:00

23 lines
699 B
C#

using System.Management.Automation;
namespace Noz.PowerShell.Cmdlets;
[Cmdlet(VerbsCommon.Get, "NozTemplate")]
[OutputType(typeof(NozTemplate))]
public sealed class GetNozTemplateCmdlet : NozCmdletBase
{
[Parameter(Position = 0)]
public string? Name { get; set; }
protected override void ProcessRecord()
{
var templates = Run(Api.GetTemplatesAsync());
var filtered = Name is null
? templates
: templates.Where(t => t.Name.Contains(Name, StringComparison.OrdinalIgnoreCase)).ToList();
foreach (var t in filtered.OrderBy(t => t.Name))
WriteObject(new NozTemplate { Name = t.Name, Description = t.Description });
}
}