using System.Management.Automation; namespace HyperBooru.PowerShell; [Alias("shbmt")] [Cmdlet(VerbsCommon.Set, "HyperBooruMediaTag")] public class SetMediaTagCmdlet : 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() { Session.Media.ReplaceTagsAsync(MediaId, TagId) .GetAwaiter() .GetResult(); var id = MediaId.ToString().ToUpper(); var tags = TagId .Order() .Distinct() .Select(t => t.ToString().ToUpper()); WriteVerbose($"Set tags for media item {id} to {string.Join(", ", tags)}"); } }