-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
executable file
·33 lines (32 loc) · 1.23 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
#!/usr/bin/env node
const lib = require('./lib')
require('yargs')
.usage('Usage: $0 <command> [options]')
.command(
'deployment <project>',
'Notify Slack of given <project>',
yargs => yargs
.positional('project', { type: 'string' })
.option('status', { type: 'string', description: 'CI status, success|failure|cancelled' })
.option('success', { type: 'boolean', description: 'DEPRECATED, use status instead' })
.option('stage', { type: 'string', default: 'dev', description: 'Project stage' })
.option('commit', { type: 'string' })
.option('build_link', { type: 'string' })
.option('slack_hook', { description: 'Slack webhook, falls back to $SLACK_HOOK env var' })
,
lib.deployment,
)
.command(
'send <title>',
'Notify Slack with <title> message',
yargs => yargs
.positional('title', { type: 'string', alias: 'message' })
.option('status', { type: 'string', description: 'CI status, success|failure|cancelled' })
.option('link', { type: 'string', description: 'URL the message should be linked to' })
.option('slack_hook', { description: 'Slack webhook, falls back to $SLACK_HOOK env var' })
,
lib.send,
)
.demandCommand()
.help()
.argv