How to use heroku-cli-util - 10 common examples

To help you get started, we’ve selected a few heroku-cli-util 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 / apps-v5 / src / commands / labs / info.js View on Github external
function * run (context, heroku) {
  let feature
  try {
    feature = yield heroku.get(`/account/features/${context.args.feature}`)
  } catch (err) {
    if (err.statusCode !== 404) throw err
    // might be an app feature
    if (!context.app) throw err
    feature = yield heroku.get(`/apps/${context.app}/features/${context.args.feature}`)
  }
  if (context.flags.json) {
    cli.styledJSON(feature)
  } else {
    print(feature)
  }
}
github heroku / cli / packages / heroku-apps / commands / config / get.js View on Github external
function* run (context, heroku) {
  let configVars = yield heroku.request({path: `/apps/${context.app}/config-vars`});
  let v = configVars[context.args.key];
  if (v === undefined) {
    cli.log(''); // match v3 output for missing
  } else {
    if (context.flags.shell) {
      v = process.stdout.isTTY ? shellescape([v]) : v;
      cli.log(`${context.args.key}=${v}`);
    } else {
      cli.log(v);
    }
  }
}
github heroku / cli / client / lib / commands / auth / whoami.js View on Github external
function * run () {
  const Heroku = require('heroku-client')

  if (process.env.HEROKU_API_KEY) {
    cli.warn('HEROKU_API_KEY is set. Not using netrc credentials.')
  }
  let token = cli.auth.token()
  if (!token) cli.exit(1, 'not logged in')
  let heroku = new Heroku({token})
  let account = yield heroku.get('/account')
  cli.log(account.email)
}
github xavdid / heroku-config / commands / push.js View on Github external
function* patchConfig(context, heroku, payload, success) {
  try {
    yield heroku.patch(`/apps/${context.app}/config-vars`, { body: payload })
    if (!context.flags.quiet) {
      cli.log(success)
    }
  } catch (err) {
    cli.exit(1, err)
  }
}
github heroku / cli / packages / spaces / commands / index.js View on Github external
function display (spaces) {
  cli.table(spaces, {
    columns: [
      { key: 'name', label: 'Name' },
      { key: 'team.name', label: 'Team' },
      { key: 'region.name', label: 'Region' },
      { key: 'state', label: 'State' },
      { key: 'created_at', label: 'Created At' }
    ]
  })
}
github heroku / cli / packages / spaces / commands / index.js View on Github external
function display (spaces) {
  cli.table(spaces, {
    columns: [
      { key: 'name', label: 'Name' },
      { key: 'team.name', label: 'Team' },
      { key: 'region.name', label: 'Region' },
      { key: 'state', label: 'State' },
      { key: 'created_at', label: 'Created At' }
    ]
  })
}
github heroku / heroku-connect-plugin / commands / connect-events / state.js View on Github external
function * run (context, heroku) {
  let connections = yield api.withUserConnections(context, context.app, context.flags, heroku, true, api.ADDON_TYPE_EVENTS)

  if (context.flags.json) {
    cli.styledJSON(connections)
  } else {
    cli.table(connections, {
      columns: [
        {key: 'db_key', label: 'Kafka'},
        {key: 'schema_name', label: 'Schema'},
        {key: 'state', label: 'State'}
      ]
    })
  }
}
github heroku / heroku-connect-plugin / commands / connect / state.js View on Github external
function * run (context, heroku) {
  let connections = yield api.withUserConnections(context, context.app, context.flags, heroku)

  if (context.flags.json) {
    cli.styledJSON(connections)
  } else {
    cli.table(connections, {
      columns: [
        {key: 'db_key', label: 'Database'},
        {key: 'schema_name', label: 'Schema'},
        {key: 'state', label: 'State'}
      ]
    })
  }
}
github heroku / heroku-container-tools / commands / login.js View on Github external
module.exports = function(topic) {
  return {
    topic: topic,
    command: 'login',
    flags: [{ name: 'verbose', char: 'v', hasValue: false }],
    description: 'Logs in to the Heroku Docker registry',
    needsApp: false,
    needsAuth: true,
    run: cli.command(co.wrap(login))
  };
};
github heroku / heroku-container-tools / commands / push.js View on Github external
module.exports = function(topic) {
  return {
    topic: topic,
    command: 'push',
    description: 'Builds, then pushes a Docker image to deploy your Heroku app',
    needsApp: true,
    needsAuth: true,
    args: [{ name: 'process', optional: true }],
    run: cli.command(co.wrap(push))
  };
};