blob: d190f2c5f0aad71466c3808232ee186aa01b6e60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using System.Management.Automation;
namespace HyperBooru.PowerShell;
[Alias("ghbu")]
[Cmdlet(VerbsCommon.Get, "HyperBooruUser")]
public class GetUserCmdlet : SessionCmdlet {
[Parameter(Position = 1)]
public Guid? UserId { get; set; }
protected override void ProcessRecord() {
ApiModels.User[] users;
if(UserId is not null)
users = [ Session.User.GetUserAsync((Guid) UserId).GetAwaiter().GetResult() ];
else
users = Session.User.GetAllUsersAsync().GetAwaiter().GetResult();
foreach(var u in users)
WriteObject(u);
}
}
|