blob: bad10d12a5e062b1bc3cd084582634df46a0b608 (
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("shbit")]
[Cmdlet(VerbsCommon.Set, "HyperBooruImplicitTag")]
public class SetImplicitTagCmdlet : 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.ReplaceImplicitTagsAsync(TagDefinitionId, ImplicitTagId)
.GetAwaiter()
.GetResult();
var id = TagDefinitionId.ToString().ToUpper();
var impl = ImplicitTagId
.Order()
.Distinct()
.Select(t => t.ToString().ToUpper());
WriteVerbose($"Set implicit tags for {id} to {string.Join(", ", impl)}");
}
}
|