blob: dade4baf0f38cb4cc706f6a5a879150b86fb953f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using HyperBooru.ApiModels;
using System.Management.Automation;
namespace HyperBooru.PowerShell;
[Alias("nhbtd")]
[Cmdlet(VerbsCommon.New, "HyperBooruTagDefinition")]
public class NewTagDefinitionCmdlet : SessionCmdlet {
[Parameter] public string? Namespace { get; set; }
[Parameter(Mandatory = true)] public required string Name { get; set; }
[Parameter] public string? Alias { get; set; }
[Parameter] public Guid[]? ImplicitTags { get; set; }
protected override void ProcessRecord() {
var tagDefinition = Session.Tag.CreateTagDefinitionAsync(new TagCreateRequest {
Namespace = Namespace,
Name = Name,
Alias = Alias,
ImplicitTags = ImplicitTags
}).GetAwaiter().GetResult();
WriteObject(tagDefinition);
}
}
|