-
Notifications
You must be signed in to change notification settings - Fork 115
/
details.ts
42 lines (37 loc) · 1.36 KB
/
details.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { flags } from '@oclif/command'
import chalk from 'chalk'
import AccountsCommandBase from '../../base/AccountsCommandBase'
import { displayCollapsedRow, displayHeader, memberHandle } from '../../helpers/display'
export default class MembershipDetailsCommand extends AccountsCommandBase {
static description = 'Display membership details by specified memberId.'
static aliases = ['membership:info', 'membership:inspect', 'membership:show']
static flags = {
memberId: flags.integer({
required: true,
char: 'm',
description: 'Member id',
}),
}
async run(): Promise<void> {
const { memberId } = this.parse(MembershipDetailsCommand).flags
const details = await this.getApi().expectedMemberDetailsById(memberId)
displayCollapsedRow({
'ID': details.id.toString(),
'Handle': memberHandle(details),
'IsVerified': details.membership.verified.toString(),
'Invites': details.membership.invites.toNumber(),
})
if (details.meta) {
displayHeader(`Metadata`)
displayCollapsedRow({
'Name': details.meta.name || chalk.gray('NOT SET'),
'About': details.meta.about || chalk.gray('NOT SET'),
})
}
displayHeader('Keys')
displayCollapsedRow({
'Root': details.membership.rootAccount.toString(),
'Controller': details.membership.controllerAccount.toString(),
})
}
}