forked from HCESrl/gitlab-standard-labels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (21 loc) · 741 Bytes
/
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
#!/usr/bin/env node
const { die, parseArgs } = require('./console/utilities')
const { actions, defaultActionKey, parseUserAction } = require('./console/actions')
const argv = parseArgs(process.argv.slice(2))
const main = async (input = argv) => {
const action = parseUserAction(input, defaultActionKey)
const requestedAction = actions[action]
if (typeof requestedAction === 'undefined') return die('Not a valid action')
try {
const options = {
delete: input.delete || input.d,
board: input.board || input.b,
token: typeof input.token !== 'undefined' ? input.token : null
}
const message = await requestedAction(input._, options)
process.exit(0)
} catch (error) {
die(error)
}
}
main()