heroku/heroku-apps

View on GitHub
src/commands/features/info.js

Summary

Maintainability
B
5 hrs
Test Coverage
'use strict'

let cli = require('heroku-cli-util')
let co = require('co')

function * run (context, heroku) {
  let feature = yield heroku.get(`/apps/${context.app}/features/${context.args.feature}`)

  if (context.flags.json) {
    cli.styledJSON(feature)
  } else {
    cli.styledHeader(feature.name)
    cli.styledObject({
      Description: feature.description,
      Enabled: feature.enabled ? cli.color.green(feature.enabled) : cli.color.red(feature.enabled),
      Docs: feature.doc_url
    })
  }
}

module.exports = {
  topic: 'features',
  command: 'info',
  description: 'display information about a feature',
  args: [{name: 'feature'}],
  flags: [{name: 'json', description: 'output in json format'}],
  needsAuth: true,
  needsApp: true,
  run: cli.command(co.wrap(run))
}