blob: db2d0bfe2c1db60c154de6e25843f3d13bde6528 (
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 System.Management.Automation;
namespace HyperBooru.PowerShell;
[Alias("ahbit")]
[Cmdlet(VerbsCommon.Add, "HyperBooruImplicitTag")]
public class AddImplicitTagCmdlet : SessionCmdlet {
[Parameter(Mandatory = true)] public required Guid TagDefinitionId { get; set; }
[Parameter(Mandatory = true)] public required Guid[] ImplicitTagId { get; set; }
protected override void ProcessRecord() {
Session.Tag.AddImplicitTagsAsync(TagDefinitionId, ImplicitTagId)
.GetAwaiter()
.GetResult();
var id = TagDefinitionId.ToString().ToUpper();
var impl = ImplicitTagId
.Order()
.Distinct()
.Select(t => t.ToString().ToUpper());
WriteVerbose($"Added implicit tags {string.Join(", ", impl)} to tag {id}");
}
}
|