1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const command_1 = require("@heroku-cli/command");
|
4 | const cli_ux_1 = require("cli-ux");
|
5 | const true_myth_1 = require("true-myth");
|
6 | const buildpack_registry_1 = require("@heroku/buildpack-registry");
|
7 | class Info extends command_1.Command {
|
8 | async run() {
|
9 | let { args } = this.parse(Info);
|
10 | let registry = new buildpack_registry_1.BuildpackRegistry();
|
11 | true_myth_1.Result.match({
|
12 | Ok: _ => { },
|
13 | Err: err => {
|
14 | this.error(`Could not publish the buildpack.\n${err}`);
|
15 | },
|
16 | }, buildpack_registry_1.BuildpackRegistry.isValidBuildpackSlug(args.buildpack));
|
17 | let result = await registry.info(args.buildpack);
|
18 | true_myth_1.Result.match({
|
19 | Ok: buildpack => {
|
20 | cli_ux_1.cli.styledHeader(args.buildpack);
|
21 | cli_ux_1.cli.styledObject(buildpack, ['description', 'category', 'license', 'support', 'source', 'readme']);
|
22 | },
|
23 | Err: err => {
|
24 | if (err.status === 404) {
|
25 | cli_ux_1.cli.error(`Could not find the buildpack '${args.buildpack}'`);
|
26 | }
|
27 | else {
|
28 | cli_ux_1.cli.error(`Problems finding buildpack info: ${err.description}`);
|
29 | }
|
30 | }
|
31 | }, result);
|
32 | }
|
33 | }
|
34 | Info.description = 'fetch info about a buildpack';
|
35 | Info.args = [
|
36 | {
|
37 | name: 'buildpack',
|
38 | required: true,
|
39 | description: 'namespace/name of the buildpack'
|
40 | }
|
41 | ];
|
42 | exports.default = Info;
|