blob: c1fd971864e94e041503661b59e18b8b1eabe7a2 (
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
25
26
27
28
|
using HyperBooru.ApiClient;
using HyperBooru.ApiModels;
using System.Management.Automation;
namespace HyperBooru.PowerShell;
[Alias("nhbtd")]
[Cmdlet(VerbsCommon.New, "HyperBooruTagDefinition")]
public class NewTagDefinitionCmdlet : PSCmdlet {
[Parameter(Mandatory = true)]
public required HBSession Session { get; set; }
[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);
}
}
|