-
Notifications
You must be signed in to change notification settings - Fork 1
/
boards.ts
76 lines (64 loc) · 2.22 KB
/
boards.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { Flags } from '@oclif/core'
import AzureDevOpsCommand from "../baseAzureDevOps.js"
import listMyWorkItems from '../funcs/dev-listMyWorkItems.js'
export default class Boards extends AzureDevOpsCommand {
static description = `Azure DevOps Boards related commands
Current functionality is listing all items`
static examples = [
'<%= config.bin %> <%= command.id %>',
]
static flags = {
// flag with a value (-n, --name=VALUE)
user: Flags.string({
char: 'u', description: `User's full name or Email address used for Azure DevOps login
"John Smith" or "john.smith@org.com.au"
NOTE: If not provided, email address used with current active subscription will be used.
This can be found or changed with the "azgo subs" command.`}),
// flag with no value (-f, --force)
// force: Flags.boolean({char: 'f'}),
list: Flags.boolean({
char: 'l',
description: "List all work items assigned to given user"
}),
includeClosed: Flags.boolean({
char: 'a',
description: "Include closed work items",
dependsOn: ['list'],
exclusive: ['includePending']
}),
includePending: Flags.boolean({
char: 'p',
description: "Include pending work items",
dependsOn: ['list'],
exclusive: ['includeClosed']
}),
filterType: Flags.string({
char: 'f',
description: "Filter on type",
dependsOn: ['list'],
options: ['Bug', 'Task']
// options: ['Bug', 'Task', 'Feature', 'Epic', 'User Story', 'Test']
}),
}
static args = [{ name: 'file' }]
public async run(): Promise<void> {
const { args, flags } = await this.parse(Boards)
const user = flags.user || Boards.subscriptions.default.username
// const { includeClosed, includePending, onlyBugs } = flags
const options = {
...flags,
user,
organization: flags['organization']
}
// console.log(flags)
// console.log(user)
if (flags.list) {
const workItems = await listMyWorkItems(options)
workItems.length != 0 && workItems.length > 1 ?
console.log(`${workItems.length} items`) :
console.log(`${workItems.length} item`)
process.exit()
}
// this.config.runCommand('help', ['boards'])
}
}