balena-cli
Version:
The official balena Command Line Interface
51 lines (50 loc) • 1.93 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const lazy_1 = require("../../utils/lazy");
const release_1 = require("../release");
class ReleaseAssetDeleteCmd extends core_1.Command {
async run() {
const { args, flags } = await this.parse(ReleaseAssetDeleteCmd);
const balena = (0, lazy_1.getBalenaSdk)();
const release = await balena.models.release.get(args.commitOrId, {
$select: ['id'],
});
const patterns = await Promise.resolve().then(() => require('../../utils/patterns'));
await patterns.confirm(flags.yes, `Are you sure you want to delete release asset '${flags.key}'?`);
await balena.models.release.asset.remove({
release: release.id,
asset_key: flags.key,
});
console.log(`Release asset '${flags.key}' deleted successfully`);
}
}
ReleaseAssetDeleteCmd.description = (0, lazy_1.stripIndent) `
Delete a release asset.
Delete a release asset with the specified key. This action cannot be undone.
`;
ReleaseAssetDeleteCmd.examples = [
'$ balena release-asset delete 1234567 --key config.json',
'$ balena release-asset delete a777f7345fe3d655c1c981aa642e5555 --key app.tar.gz',
'$ balena release-asset delete 1234567 --key old-asset --yes',
];
ReleaseAssetDeleteCmd.args = {
commitOrId: (0, release_1.commitOrIdArg)({
description: 'the commit or ID of the release',
required: true,
}),
};
ReleaseAssetDeleteCmd.flags = {
key: core_1.Flags.string({
description: 'the key of the release asset to delete',
required: true,
}),
yes: core_1.Flags.boolean({
char: 'y',
description: 'skip confirmation prompt',
default: false,
}),
};
ReleaseAssetDeleteCmd.authenticated = true;
exports.default = ReleaseAssetDeleteCmd;
//# sourceMappingURL=delete.js.map