diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-06-15 12:54:44 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-15 12:54:44 +1000 |
| commit | d36e27387eabf88845d364b9d3a2da54a583247f (patch) | |
| tree | 716058aac0b72c1ec1bb0b7eb47d4e3a87926299 /AddImplicitTag.cs | |
| parent | ab46387d4d02e30b171a7c2fa07947b41ec691a0 (diff) | |
Diffstat (limited to 'AddImplicitTag.cs')
| -rw-r--r-- | AddImplicitTag.cs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/AddImplicitTag.cs b/AddImplicitTag.cs index 50f6cfc..db2d0bf 100644 --- a/AddImplicitTag.cs +++ b/AddImplicitTag.cs @@ -1,17 +1,24 @@ -using HyperBooru.ApiClient; -using System.Management.Automation; +using System.Management.Automation; namespace HyperBooru.PowerShell; [Alias("ahbit")] [Cmdlet(VerbsCommon.Add, "HyperBooruImplicitTag")] -public class AddImplicitTagCmdlet : PSCmdlet { - [Parameter(Mandatory = true)] public required HBSession Session { get; set; } - [Parameter(Mandatory = true)] public required Guid TagDefinitionId { get; set; } - [Parameter(Mandatory = true)] public required Guid[] ImplicitTagId { get; set; } +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() => + 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}"); + } } |
