Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static examples = [
'$ heroku run bash',
'$ heroku run -s hobby -- myscript.sh -a arg1 -s arg2'
]
// This is to allow for variable length arguments
static strict = false
static flags = {
app: flags.app({description: 'parent app used by review apps', required: true}),
remote: flags.remote(),
size: flags.string({char: 's', description: 'dyno size', completion: DynoSizeCompletion}),
type: flags.string({description: 'process type', completion: ProcessTypeCompletion}),
'exit-code': flags.boolean({char: 'x', description: 'passthrough the exit code of the remote command'}),
env: flags.string({char: 'e', description: "environment variables to set (use ';' to split multiple vars)"}),
'no-tty': flags.boolean({description: 'force the command to not run in a tty'}),
listen: flags.boolean({description: 'listen on a local port', hidden: true}),
'no-notify': flags.boolean({description: 'disables notification when dyno is up (alternatively use HEROKU_NOTIFICATIONS=0)'})
}
async run() {
const {argv, flags} = this.parse(Run)
let opts = {
'exit-code': flags['exit-code'],
'no-tty': flags['no-tty'],
app: flags.app,
attach: true,
command: buildCommand(argv),
env: flags.env,
heroku: this.heroku,
// tslint:disable:file-name-casing
import {Command, flags} from '@heroku-cli/command'
import {DynoSizeCompletion} from '@heroku-cli/command/lib/completions'
import Dyno from '../lib/dyno'
import {buildCommand} from '../lib/helpers'
export default class RunConsole extends Command {
static hidden = true
static flags = {
app: flags.app({required: true}),
remote: flags.remote(),
size: flags.string({char: 's', description: 'dyno size', completion: DynoSizeCompletion}),
env: flags.string({char: 'e', description: 'environment variables to set (use \';\' to split multiple vars)'})
}
async run() {
let {flags} = this.parse(RunConsole)
let opts = {
heroku: this.heroku,
app: flags.app,
command: buildCommand(['console']),
size: flags.size,
env: flags.env,
attach: true
}
let dyno = new Dyno(opts)
Update.description = 'updates a webhook in an app'
Update.examples = [
'$ heroku webhooks:update 99999999-9999-9999-9999-999999999999 -i dyno -l notify -s 09928c40bf1b191b645174a19f7053d16a180da37332e719ef0998f4c0a2 -u https://example.com/hooks'
]
Update.flags = {
app: flags.app(),
remote: flags.remote(),
pipeline: flags.string({ char: 'p', description: 'pipeline on which to list', hidden: true }),
include: flags.string({ char: 'i', description: 'comma delimited event types your server will receive ', required: true }),
level: flags.string({ char: 'l', description: 'notify does not retry, sync will retry until successful or timeout', required: true }),
secret: flags.string({ char: 's', description: 'value to sign delivery with in Heroku-Webhook-Hmac-SHA256 header' }),
authorization: flags.string({ char: 't', description: 'authoriation header to send with webhooks' }),
url: flags.string({ char: 'u', description: 'URL for receiver', required: true })
}
Update.args = [
{ name: 'id' }
]
module.exports = Update
//
// 'use strict'
//
// let co = require('co')
// let cli = require('heroku-cli-util')
// let webhookType = require('../../lib/webhook-type.js')
//
// function * run(context, heroku) {
}
const MULTIPLE_SNI_ENDPOINT_FLAG = 'allow-multiple-sni-endpoints'
export default class DomainsAdd extends Command {
static description = 'add a domain to an app'
static examples = ['heroku domains:add www.example.com']
static flags = {
help: flags.help({char: 'h'}),
app: flags.app({required: true}),
cert: flags.string({description: 'the name of the SSL cert you want to use for this domain', char: 'c'}),
json: flags.boolean({description: 'output in json format', char: 'j'}),
remote: flags.remote(),
wait: flags.boolean()
}
static args = [{name: 'hostname', required: true}]
createDomain = async (appName: string, payload: DomainCreatePayload): Promise => {
cli.action.start(`Adding ${color.green(payload.hostname)} to ${color.app(appName)}`)
try {
const response = await this.heroku.post(`/apps/${appName}/domains`, {
headers: {Accept: 'application/vnd.heroku+json; version=3.allow_multiple_sni_endpoints'},
body: payload
})
return response.body
} catch (err) {
// If the error indicates that the app has multiple certs needs the user to specify which one
// to use, we ask them which cert to use, otherwise we rethrow the error and handle it like usual
if (err.body.id === 'invalid_params' && err.body.message.includes('sni_endpoint')) {
// @flow
import {Command, flags} from '@heroku-cli/command'
import {cli} from 'cli-ux'
export default class LabsDisable extends Command {
static topic = 'regions'
static description = 'list available regions for deployment'
static flags = {
json: flags.boolean({description: 'output in json format'}),
private: flags.boolean({description: 'show regions for private spaces'}),
common: flags.boolean({description: 'show regions for common runtime'})
}
async run () {
const sortBy = require('lodash.sortby')
let {body: regions} = await this.heroku.get('/regions')
if (this.flags.private) {
regions = regions.filter(region => region.private_capable)
} else if (this.flags.common) {
regions = regions.filter(region => !region.private_capable)
}
regions = sortBy(regions, ['private_capable', 'name'])
if (this.flags.json) {
cli.styledJSON(regions)
} else {
'$ heroku run -s hobby -- myscript.sh -a arg1 -s arg2'
]
// This is to allow for variable length arguments
static strict = false
static flags = {
app: flags.app({description: 'parent app used by review apps', required: true}),
remote: flags.remote(),
size: flags.string({char: 's', description: 'dyno size', completion: DynoSizeCompletion}),
type: flags.string({description: 'process type', completion: ProcessTypeCompletion}),
'exit-code': flags.boolean({char: 'x', description: 'passthrough the exit code of the remote command'}),
env: flags.string({char: 'e', description: "environment variables to set (use ';' to split multiple vars)"}),
'no-tty': flags.boolean({description: 'force the command to not run in a tty'}),
listen: flags.boolean({description: 'listen on a local port', hidden: true}),
'no-notify': flags.boolean({description: 'disables notification when dyno is up (alternatively use HEROKU_NOTIFICATIONS=0)'})
}
async run() {
const {argv, flags} = this.parse(Run)
let opts = {
'exit-code': flags['exit-code'],
'no-tty': flags['no-tty'],
app: flags.app,
attach: true,
command: buildCommand(argv),
env: flags.env,
heroku: this.heroku,
listen: flags.listen,
notify: !flags['no-notify'],
size: flags.size,
const debug = DebugFactory('heroku:run')
export default class Run extends Command {
static description = 'run a one-off process inside a heroku dyno\nShows a notification if the dyno takes more than 20 seconds to start.'
static examples = [
'$ heroku run bash',
'$ heroku run -s hobby -- myscript.sh -a arg1 -s arg2'
]
// This is to allow for variable length arguments
static strict = false
static flags = {
app: flags.app({description: 'parent app used by review apps', required: true}),
remote: flags.remote(),
size: flags.string({char: 's', description: 'dyno size', completion: DynoSizeCompletion}),
type: flags.string({description: 'process type', completion: ProcessTypeCompletion}),
'exit-code': flags.boolean({char: 'x', description: 'passthrough the exit code of the remote command'}),
env: flags.string({char: 'e', description: "environment variables to set (use ';' to split multiple vars)"}),
'no-tty': flags.boolean({description: 'force the command to not run in a tty'}),
listen: flags.boolean({description: 'listen on a local port', hidden: true}),
'no-notify': flags.boolean({description: 'disables notification when dyno is up (alternatively use HEROKU_NOTIFICATIONS=0)'})
}
async run() {
const {argv, flags} = this.parse(Run)
let opts = {
'exit-code': flags['exit-code'],
'no-tty': flags['no-tty'],
app: flags.app,
{name: 'app', char: 'a', hasValue: true, hidden: true},
{name: 'addons', hasValue: true, description: 'comma-delimited list of addons to install'},
{name: 'buildpack', char: 'b', hasValue: true, description: 'buildpack url to use for this app', completion: BuildpackCompletion},
{name: 'manifest', char: 'm', hasValue: false, description: 'use heroku.yml settings for this app', hidden: true},
{name: 'no-remote', char: 'n', description: 'do not create a git remote'},
{name: 'remote', char: 'r', hasValue: true, description: 'the git remote to create, default "heroku"', completion: RemoteCompletion},
{name: 'stack', char: 's', hasValue: true, description: 'the stack to create the app on', completion: StackCompletion},
{name: 'space', hasValue: true, description: 'the private space to create the app in', completion: SpaceCompletion},
{name: 'region', hasValue: true, description: 'specify region for the app to run in', completion: RegionCompletion},
{name: 'ssh-git', description: 'use SSH git protocol for local git remote'},
{name: 'internal-routing', hidden: true, description: 'private space-only. create as an Internal Web App that is only routable in the local network.'},
{name: 'kernel', hidden: true, hasValue: true},
{name: 'locked', hidden: true},
{name: 'json', description: 'output in json format'},
// flags.org({name: 'org', hasValue: true}),
flags.team({name: 'team', hasValue: true})
],
run: cli.command(run)
}
module.exports = [
Object.assign({topic: 'apps', command: 'create'}, cmd),
Object.assign({hidden: true, topic: 'create'}, cmd)
]
=== My Apps
example
example2
=== Collaborated Apps
theirapp other@owner.name`,
needsAuth: true,
wantsOrg: true,
flags: [
{name: 'all', char: 'A', description: 'include apps in all teams'},
{name: 'json', description: 'output in json format'},
{name: 'space', char: 's', hasValue: true, description: 'filter by space', completion: SpaceCompletion},
{name: 'personal', char: 'p', description: 'list apps in personal account when a default team is set'},
{name: 'internal-routing', hidden: true, char: 'i', description: 'filter to Internal Web Apps'},
// flags.org({name: 'org', hasValue: true}),
flags.team({name: 'team', hasValue: true})
],
run: cli.command(co.wrap(run))
}
module.exports = [
Object.assign({topic: 'apps'}, cmd),
Object.assign({topic: 'list', hidden: true}, cmd),
Object.assign({topic: 'apps', command: 'list', hidden: true}, cmd)
]
const rmKey = (cacheKey: string) => fs.remove(path.join(completionsDir, cacheKey))
if (type === 'app') return rmKey('app')
if (type === 'addon' && app) return rmKey(`${app}_addons`)
if (type === 'config' && app) return rmKey(`${app}_config_vars`)
if (logInOut) return rm()
const update = async (completion: any, cacheKey: string) => {
const cachePath = path.join(completionsDir, cacheKey)
const options = await completion.options({config: this.config})
await updateCache(cachePath, options)
}
// if user is not logged in, exit
try {
const heroku = new APIClient(this.config)
if (!heroku.auth) return
await heroku.get('/account', {retryAuth: false})
} catch (err) {
this.debug(err.message)
return
}
cli.action.start('Updating completions')
await rm()
await acCreate.run([], this.config)
try {
await update(AppCompletion, 'app')
await update(PipelineCompletion, 'pipeline')
await update(SpaceCompletion, 'space')
await update(TeamCompletion, 'team')