How to use the @heroku-cli/command.flags.remote function in @heroku-cli/command

To help you get started, we’ve selected a few @heroku-cli/command examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heroku / cli / packages / run / src / commands / run / index.ts View on Github external
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,
github heroku / cli / packages / webhooks / src / commands / webhooks / events / index.ts View on Github external
import {flags} from '@heroku-cli/command'
import {cli} from 'cli-ux'

import BaseCommand from '../../base'

export default class EventsIndex extends BaseCommand {
  static description = 'list webhook events on an app'

  static examples = [
    '$ heroku webhooks:events',
  ]

  static flags = {
    app: flags.app(),
    remote: flags.remote(),
    pipeline: flags.pipeline({char: 'p', description: 'pipeline on which to list', hidden: true}),
  }

  async run() {
    const {flags} = this.parse(EventsIndex)
    const {path, display} = this.webhookType(flags)

    cli.warn('heroku webhooks:event is deprecated, please use heroku webhooks:deliveries')

    const {body: events} = await this.webhooksClient.get(`${path}/webhook-events`)

    if (events.length === 0) {
      this.log(`${display} has no events`)
    } else {
      events.sort((a: any, b: any) => Date.parse(a.created_at) - Date.parse(b.created_at))
github heroku / cli / packages / pipelines / src / commands / pipelines / update.ts View on Github external
import {Command, flags} from '@heroku-cli/command'
import {StageCompletion} from '@heroku-cli/command/lib/completions'
import cli from 'cli-ux'

import {updateCoupling} from '../../api'

export default class PipelinesUpdate extends Command {
  static description = 'update the app\'s stage in a pipeline'

  static examples = [
    '$ heroku pipelines:update -s staging -a my-app',
  ]

  static flags = {
    app: flags.app({required: true}),
    remote: flags.remote(),
    stage: flags.string({
      char: 's',
      description: 'new stage of app',
      completion: StageCompletion,
      required: true,
    }),
  }

  async run() {
    const {flags} = this.parse(PipelinesUpdate)

    const app = flags.app
    const stage = flags.stage

    cli.action.start(`Changing ${color.app(app)} to ${stage}`)
    await updateCoupling(this.heroku, app, stage)
github heroku / cli / packages / config / src / commands / config / index.ts View on Github external
import color from '@heroku-cli/color'
import {Command, flags} from '@heroku-cli/command'
import * as Heroku from '@heroku-cli/schema'
import ux from 'cli-ux'
import * as _ from 'lodash'

import {quote} from '../../quote'

export class ConfigIndex extends Command {
  static description = 'display the config vars for an app'
  static flags = {
    app: flags.app({required: true}),
    remote: flags.remote(),
    shell: flags.boolean({char: 's', description: 'output config vars in shell format'}),
    json: flags.boolean({char: 'j', description: 'output config vars in json format'}),
  }

  async run() {
    const {flags} = this.parse(ConfigIndex)
    const {body: config} = await this.heroku.get(`/apps/${flags.app}/config-vars`)
    if (flags.shell) {
      Object.entries(config)
        .forEach(([k, v]) => ux.log(`${k}=${quote(v)}`))
    } else if (flags.json) {
      ux.styledJSON(config)
    } else {
      ux.styledHeader(`${flags.app} Config Vars`)
      ux.styledObject(_.mapKeys(config, (_, k) => color.configVar(k)))
    }
github heroku / cli / packages / webhooks / src / commands / webhooks / info.ts View on Github external
import {flags} from '@heroku-cli/command'
import {cli} from 'cli-ux'

import BaseCommand from '../base'

export default class WebhooksInfo extends BaseCommand {
  static description = 'info for a webhook on an app'

  static example = ['$ heroku webhooks:info 99999999-9999-9999-9999-999999999999']

  static flags = {
    app: flags.app(),
    remote: flags.remote(),
    pipeline: flags.pipeline({char: 'p', description: 'pipeline on which to list', hidden: true}),
  }

  static args = [{name: 'id', required: true}]

  async run() {
    const {flags, args} = this.parse(WebhooksInfo)
    const {path} = this.webhookType(flags)

    const {body: webhook} = await this.webhooksClient.get(`${path}/webhooks/${args.id}`)

    const obj = {
      'Webhook ID': webhook.id,
      URL: webhook.url,
      Include: webhook.include.join(','),
      Level: webhook.level,
github heroku / cli / packages / apps / src / commands / domains / remove.ts View on Github external
import {color} from '@heroku-cli/color'
import {Command, flags} from '@heroku-cli/command'
import cli from 'cli-ux'

export default class DomainsRemove extends Command {
  static description = 'remove a domain from an app'

  static examples = ['heroku domains:remove www.example.com']

  static flags = {
    help: flags.help({char: 'h'}),
    app: flags.app({required: true}),
    remote: flags.remote(),
  }

  static args = [{name: 'hostname', required: true}]

  async run() {
    const {args, flags} = this.parse(DomainsRemove)
    cli.action.start(`Removing ${color.green(args.hostname)} from ${color.app(flags.app)}`)
    await this.heroku.delete(`/apps/${flags.app}/domains/${args.hostname}`)
    cli.action.stop()
  }
}
github heroku / cli / packages / auth / src / commands / labs / disable.ts View on Github external
'spaces-strict-tls': {
    async prompt(out: any, app: string): Promise {
      out.warn('Insecure Action')
      let name = await cli.prompt(`You are enabling an older security protocol, TLS 1.0, which some organizations may not deem secure.
To proceed, type ${app} or re-run this command with --confirm ${app}`)
      return name
    }
  }
}

export default class LabsDisable extends Command {
  static description = 'disables an experimental feature'
  static args = [{name: 'feature'}]
  static flags = {
    app: flags.app(),
    remote: flags.remote(),
    confirm: flags.string({required: false})
  }

  async run() {
    const {args, flags} = this.parse(LabsDisable)
    let feature = args.feature
    let request
    let target

    if (SecurityExceptionFeatures[feature]) {
      if (flags.confirm !== flags.app) {
        let prompt = SecurityExceptionFeatures[feature].prompt
        let confirm = await prompt(cli, flags.app)
        if (confirm !== flags.app) {
          this.error('Confirmation name did not match app name. Try again.')
        }
github heroku / cli / packages / webhooks-v5 / commands / webhooks / add.js View on Github external
if (secret) {
      cli.styledHeader('Webhooks Signing Secret')
      cli.log(secret)
    }
  }
}

Add.description = 'add a webhook to an app'

Add.examples = [
  '$ heroku webhooks:add -i api:dyno -l notify -u https://example.com/hooks'
]

Add.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 })
}

module.exports = Add
github heroku / cli / packages / pipelines / src / commands / pipelines / remove.ts View on Github external
import color from '@heroku-cli/color'
import {Command, flags} from '@heroku-cli/command'
import cli from 'cli-ux'

import {removeCoupling} from '../../api'

export default class PipelinesRemove extends Command {
  static description = 'remove this app from its pipeline'

  static examples = [
    '$ heroku pipelines:remove -a my-app',
  ]

  static flags = {
    app: flags.app({required: true}),
    remote: flags.remote(),
  }

  async run() {
    const {flags: {app}} = this.parse(PipelinesRemove)

    cli.action.start(`Removing ${color.app(app)}`)
    await removeCoupling(this.heroku, app)
    cli.action.stop()
  }
}
github heroku / cli / packages / buildpacks / src / commands / buildpacks / add.ts View on Github external
import {Command, flags as Flags} from '@heroku-cli/command'

import {BuildpackCommand} from '../../buildpacks'

export default class Add extends Command {
  static description = 'add new app buildpack, inserting into list of buildpacks if necessary'

  static flags = {
    app: Flags.app({required: true}),
    remote: Flags.remote(),
    index: Flags.integer({
      description: 'the 1-based index of the URL in the list of URLs',
      char: 'i',
    }),
  }

  static args = [
    {
      name: 'buildpack',
      required: true,
      description: 'namespace/name of the buildpack',
    },
  ]

  async run() {
    const {args, flags} = this.parse(Add)