From d36e27387eabf88845d364b9d3a2da54a583247f Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Mon, 15 Jun 2026 12:54:44 +1000 Subject: v0.18a --- RemoveMediaTag.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'RemoveMediaTag.cs') diff --git a/RemoveMediaTag.cs b/RemoveMediaTag.cs index d41980d..de10611 100644 --- a/RemoveMediaTag.cs +++ b/RemoveMediaTag.cs @@ -1,22 +1,27 @@ -using HyperBooru.ApiClient; -using System.Management.Automation; +using System.Management.Automation; namespace HyperBooru.PowerShell; [Alias("rhbmt")] [Cmdlet(VerbsCommon.Remove, "HyperBooruMediaTag")] -public class RemoveMediaTagCmdlet : PSCmdlet { - [Parameter(Position = 0, Mandatory = true)] - public required HBSession Session { get; set; } - +public class RemoveMediaTagCmdlet : SessionCmdlet { [Parameter(Position = 1, Mandatory = true)] public Guid MediaId { get; set; } [Parameter(Position = 2, Mandatory = true)] public Guid[] TagId { get; set; } - protected override void ProcessRecord() => + protected override void ProcessRecord() { Session.Media.DeleteTagsAsync(MediaId, TagId) .GetAwaiter() .GetResult(); + + var id = MediaId.ToString().ToUpper(); + var tags = TagId + .Order() + .Distinct() + .Select(t => t.ToString().ToUpper()); + + WriteVerbose($"Removed tags {string.Join(", ", tags)} from media item {id}"); + } } -- cgit v1.3