UNPKG

659 BJavaScriptView Raw
1'use strict'
2
3let cli = require('heroku-cli-util')
4let co = require('co')
5
6function * run (context, heroku) {
7 let request = heroku.get('/account')
8 .then(function (user) {
9 return heroku.post(`/organizations/apps/${context.app}/collaborators`, {
10 body: { user: user.email }
11 })
12 })
13
14 yield cli.action(`Joining ${cli.color.cyan(context.app)}`, request)
15}
16
17let cmd = {
18 topic: 'apps',
19 command: 'join',
20 description: 'add yourself to an organization app',
21 needsAuth: true,
22 needsApp: true,
23 run: cli.command(co.wrap(run))
24}
25
26module.exports.apps = cmd
27module.exports.root = Object.assign({}, cmd, {topic: 'join', command: null})