-
Notifications
You must be signed in to change notification settings - Fork 115
/
application.ts
43 lines (37 loc) · 1.4 KB
/
application.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
43
import WorkingGroupsCommandBase from '../../base/WorkingGroupsCommandBase'
import { displayCollapsedRow, displayHeader, memberHandle } from '../../helpers/display'
import chalk from 'chalk'
export default class WorkingGroupsApplication extends WorkingGroupsCommandBase {
static description = 'Shows an overview of given application by Working Group Application ID'
static args = [
{
name: 'wgApplicationId',
required: true,
description: 'Working Group Application ID',
},
]
static flags = {
...WorkingGroupsCommandBase.flags,
}
async run(): Promise<void> {
const { args } = this.parse(WorkingGroupsApplication)
const application = await this.getApi().groupApplication(this.group, parseInt(args.wgApplicationId))
displayHeader(`Details`)
const applicationRow = {
'Application ID': application.applicationId,
'Opening ID': application.openingId.toString(),
'Member handle': memberHandle(application.member),
'Role account': application.roleAccount.toString(),
'Reward account': application.rewardAccount.toString(),
'Staking account': application.stakingAccount.toString(),
}
displayCollapsedRow(applicationRow)
if (application.answers) {
displayHeader(`Application form`)
application.answers?.forEach((a) => {
this.log(chalk.bold(a.question.question))
this.log(a.answer)
})
}
}
}