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

namespace HyperBooru.PowerShell;

[Alias("rhbu")]
[Cmdlet(VerbsCommon.Remove, "HyperBooruUser")]
public class RemoveUserCmdlet : SessionCmdlet {
    [Parameter(Position = 1, Mandatory = true)]
    public Guid UserId { get; set; }

    protected override void ProcessRecord() {
        Session.User.DeleteUserAsync(UserId)
            .GetAwaiter()
            .GetResult();

        WriteVerbose($"Removed user {UserId.ToString().ToUpper()}");
    }
}