-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·246 lines (243 loc) · 5.91 KB
/
index.js
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#!/usr/bin/env node
const yargs = require('yargs')
const package = require('./package.json')
const actions = require('./src/actions')
const epilogText = `
Made with ❤️ by VivifyScrum
https://www.vivifyscrum.com/
`
yargs
.usage('$0 <command> [options]', 'VivifyScrum CLI tool')
.command(
'store [code] [email] [token]',
'Persist Board Auth data (token)',
yargs => {
yargs
.positional('name', {
alias: 'n',
describe: 'Board auth data name',
default: 'default',
type: 'string'
})
.positional('code', {
alias: 'c',
describe: 'Board Code',
type: 'string'
})
.positional('email', {
alias: 'e',
describe: 'User email (any Board member)',
type: 'string'
})
.positional('token', {
alias: 't',
describe: 'Board auth token (you must be authorized for API actions)',
type: 'string'
})
.demandOption(['c', 't', 'e'])
},
args => {
actions.storeBoardAuthData(args.name, args.code, args.email, args.token)
}
)
.command(
'remove [name]',
'Remove persisted Board auth data',
yargs => {
yargs
.positional('name', {
alias: 'n',
describe: 'Board auth data name',
default: 'default',
type: 'string'
})
.demandOption(['n'])
},
args => {
actions.removeBoardAuthData(args.name)
}
)
.command(
'list',
'List persisted Board auth data names',
yargs => {},
args => {
actions.listBoardsAuthData()
}
)
.command(
'show:board [board]',
'Show Board',
yargs => {
yargs
.positional('board', {
alias: 'b',
describe: 'Persisted Board auth data name',
default: 'default',
type: 'string'
})
.positional('size', {
alias: 's',
describe: 'Number of Columns to display. Default number is 4',
default: 4,
type: 'number'
})
},
async args => {
await actions.showBoard(args.board, args.size)
}
)
.command(
'show:item [board] [hascode]',
'Show Board Item',
yargs => {
yargs
.positional('board', {
alias: 'b',
describe: 'Persisted Board auth data name',
default: 'default',
type: 'string'
})
.positional('hashcode', {
alias: 'h',
describe: 'Item hashcode',
type: 'string'
})
.demandOption(['h'])
},
args => {
actions.showItem(args.board, args.hashcode)
}
)
.command(
'create:item [board] [name]',
'Create Board Item',
yargs => {
yargs
.positional('board', {
alias: 'b',
describe: 'Persisted Board auth data name',
default: 'default',
type: 'string'
})
.positional('name', {
alias: 'n',
describe: 'Item name',
type: 'string'
})
.positional('description', {
alias: 'd',
describe: 'Item description',
type: 'string',
default: ''
})
.positional('type', {
alias: 't',
describe: 'Item type',
type: 'string',
default: 'Story',
choices: ['Story', 'Improvement', 'Bug', 'Task', 'Note']
})
.positional('sprint', {
alias: 's',
describe: 'Sprint column name or Kanban list name',
type: 'string',
default: ''
})
.demandOption(['n'])
},
args => {
actions.createItem(args.board, {
name: args.name,
description: args.description,
type: args.type,
sprint: args.sprint
})
}
)
.command(
'update:item [board] [hashcode]',
'Update Board Item',
yargs => {
yargs
.positional('board', {
alias: 'b',
describe: 'Persisted Board auth data name',
default: 'default',
type: 'string'
})
.positional('hashcode', {
alias: 'h',
describe: 'Item hashcode',
type: 'string'
})
.positional('name', {
alias: 'n',
describe: 'Item name',
type: 'string'
})
.positional('description', {
alias: 'd',
describe: 'Item description',
type: 'string',
default: ''
})
.positional('type', {
alias: 't',
describe: 'Item type',
type: 'string',
default: 'Story',
choices: ['Story', 'Improvement', 'Bug', 'Task', 'Note']
})
.positional('sprint', {
alias: 's',
describe: 'Sprint column name or Kanban list name',
type: 'string',
default: ''
})
.demandOption(['h'])
},
args => {
actions.updateItem(args.board, {
task: args.hashcode,
name: args.name,
description: args.description,
type: args.type,
sprint: args.sprint
})
}
)
.command(
'remove:item [board] [hashcode] [remove_subitems]',
'Remove Board Item',
yargs => {
yargs
.positional('board', {
alias: 'b',
describe: 'Persisted Board auth data name',
default: 'default',
type: 'string'
})
.positional('hashcode', {
alias: 'h',
describe: 'Item hashcode',
type: 'string'
})
.positional('remove_subitems', {
alias: 'r',
describe: 'Remove Subitems flag',
type: 'boolean',
default: false
})
.demandOption(['h'])
},
args => {
actions.removeItem(args.board, {
task: args.hashcode,
delete_subtasks: args.remove_subitems
})
}
)
.command('help', 'Show Help')
.version(package.version)
.epilog(epilogText).argv