1 | const cli = require('heroku-cli-util')
|
2 |
|
3 | let usage = `
|
4 | ${cli.color.bold.underline.magenta('Usage:')}
|
5 | ${cli.color.cmd('heroku container:rm web')} # Destroys the web container
|
6 | ${cli.color.cmd('heroku container:rm web worker')} # Destroys the web and worker containers`
|
7 |
|
8 | module.exports = function (topic) {
|
9 | return {
|
10 | topic: topic,
|
11 | command: 'rm',
|
12 | description: 'remove the process type from your app',
|
13 | needsApp: true,
|
14 | needsAuth: true,
|
15 | variableArgs: true,
|
16 | help: usage,
|
17 | flags: [],
|
18 | run: cli.command(rm)
|
19 | }
|
20 | }
|
21 |
|
22 | let rm = async function (context, heroku) {
|
23 | if (context.args.length === 0) {
|
24 | cli.error(`Error: Please specify at least one target process type\n ${usage} `, 1)
|
25 | }
|
26 |
|
27 | for (let container of context.args) {
|
28 | let r = heroku.request({
|
29 | method: 'PATCH',
|
30 | path: `/apps/${context.app}/formation/${container}`,
|
31 | headers: {'Accept': `application/vnd.heroku+json; version=3.docker-releases`},
|
32 | body: { docker_image: null }
|
33 | })
|
34 | await cli.action(`Removing container ${container} for ${cli.color.app(context.app)}`, r)
|
35 | }
|
36 | }
|