summaryrefslogtreecommitdiff
path: root/RemoveMedia.cs
blob: 48ea13ea95e54d2b9303e5478702bcfcc6b16975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System.Management.Automation;

namespace HyperBooru.PowerShell;

[Alias("rhbm")]
[Cmdlet(VerbsCommon.Remove, "HyperBooruMedia")]
public class RemoveMediaCmdlet : SessionCmdlet {
    [Parameter(Mandatory = true)]
    public Guid MediaId { get; set; }

    protected override void ProcessRecord() {
        Session.Media.DeleteAsync(MediaId).GetAwaiter().GetResult();

        WriteVerbose($"Removed media item {MediaId}");
    }
}