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.
23 lines
699 B
C#
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 });
|
|
}
|
|
}
|