How to use the cli-ux.cli.styledHeader function in cli-ux

To help you get started, we’ve selected a few cli-ux 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 / webhooks / src / commands / webhooks / add.ts View on Github external
const response = await this.webhooksClient.post(`${path}/webhooks`, {
      body: {
        include: flags.include.split(',').map(s => s.trim()),
        level: flags.level,
        secret: flags.secret,
        url: flags.url,
        authorization: flags.authorization,
      },
    })

    const secret = response.headers && response.headers['heroku-webhook-secret'] as string

    cli.action.stop()

    if (secret) {
      cli.styledHeader('Webhooks Signing Secret')
      this.log(secret)
    } else {
      cli.warn('no secret found')
    }
  }
}
github heroku / cli / packages / oauth / src / commands / clients / rotate.ts View on Github external
cli.action.start(`Updating ${color.cyan(args.id)}`)

    const {body: client} = await this.heroku.post(
      `/oauth/clients/${encodeURIComponent(args.id)}/actions/rotate-credentials`,
    )

    cli.action.stop()

    if (flags.json) {
      cli.styledJSON(client)
    } else if (flags.shell) {
      cli.log(`HEROKU_OAUTH_ID=${client.id}`)
      cli.log(`HEROKU_OAUTH_SECRET=${client.secret}`)
    } else {
      cli.styledHeader(`${client.name}`)
      cli.styledObject(client)
    }
  }
}
github heroku / cli / packages / buildpacks / src / commands / buildpacks / index.ts View on Github external
async run() {
    let {flags} = this.parse(Index)
    let buildpacksCommand = new BuildpackCommand(this.heroku)

    let buildpacks = await buildpacksCommand.fetch(flags.app)
    if (buildpacks.length === 0) {
      this.log(`${flags.app} has no Buildpack URL set.`)
    } else {
      cli.styledHeader(`${flags.app} Buildpack URL${buildpacks.length > 1 ? 's' : ''}`)
      buildpacksCommand.display(buildpacks, '')
    }
  }
}
github heroku / cli / packages / webhooks / src / commands / webhooks / deliveries / info.ts View on Github external
Created: delivery.created_at,
      Event: delivery.event.id,
      Webhook: delivery.webhook.id,
      Status: delivery.status,
      Include: delivery.event.include,
      Level: delivery.webhook.level,
      Attempts: delivery.num_attempts,
      Code: delivery.last_attempt && delivery.last_attempt.code,
      Error: delivery.last_attempt && delivery.last_attempt.error_class,
      'Next Attempt': delivery.next_attempt_at
    }

    cli.styledHeader(delivery.id)
    cli.styledObject(obj)

    cli.styledHeader('Event Payload')
    cli.styledJSON(event.payload)
  }
}
github heroku / cli / packages / webhooks / src / commands / webhooks / events / info.ts View on Github external
async run() {
    const {flags, args} = this.parse(Info)
    const {path} = this.webhookType(flags)

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

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

    const obj = {
      payload: JSON.stringify(webhookEvent.payload, null, 2),
    }

    cli.styledHeader(webhookEvent.id)
    cli.styledObject(obj)
  }
}
github heroku / cli / packages / buildpacks / src / commands / buildpacks / info.ts View on Github external
Ok: buildpack => {
        cli.styledHeader(args.buildpack)
        cli.styledObject(buildpack, ['description', 'category', 'license', 'support', 'source', 'readme'])
      },
      Err: err => {
github heroku / cli / packages / oauth / src / commands / clients / info.ts View on Github external
async run() {
    const {args, flags} = this.parse(ClientsInfo)

    const {body: client} = await this.heroku.get(`/oauth/clients/${args.id}`)

    if (flags.json) {
      cli.styledJSON(client)
    } else if (flags.shell) {
      cli.log(`HEROKU_OAUTH_ID=${client.id}`)
      cli.log(`HEROKU_OAUTH_SECRET=${client.secret}`)
    } else {
      cli.styledHeader(`${client.name}`)
      cli.styledObject(client)
    }
  }
}
github heroku / cli / packages / webhooks / src / commands / webhooks / deliveries / info.ts View on Github external
const {body: event} = await this.webhooksClient.get(`${path}/webhook-events/${delivery.event.id}`)

    const obj = {
      Created: delivery.created_at,
      Event: delivery.event.id,
      Webhook: delivery.webhook.id,
      Status: delivery.status,
      Include: delivery.event.include,
      Level: delivery.webhook.level,
      Attempts: delivery.num_attempts,
      Code: delivery.last_attempt && delivery.last_attempt.code,
      Error: delivery.last_attempt && delivery.last_attempt.error_class,
      'Next Attempt': delivery.next_attempt_at
    }

    cli.styledHeader(delivery.id)
    cli.styledObject(obj)

    cli.styledHeader('Event Payload')
    cli.styledJSON(event.payload)
  }
}
github heroku / cli / packages / webhooks / src / commands / webhooks / info.ts View on Github external
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,
    }

    cli.styledHeader(webhook.id)
    cli.styledObject(obj)
  }
}