import chalk from 'chalk'; import {command, help, namespace, option, param} from 'oo-cli'; import {die} from '../../lib/die'; import {Rivendell} from '../../lib/Rivendell'; import {formatError} from '../../lib/formatError'; @namespace('directory') export class UninstallCommand { @param @help('The App ID') public appId!: string; @param @help('The Tracker ID of the account to install into') public trackerId!: string; @option('a') @help('The availability zone that will be targeted (default: us)') private availability: string = ''; @command @help('Uninstall an app from an account') public async uninstall() { try { const install = await Rivendell.fetchAppInstallation(this.appId, this.trackerId, this.availability); await Rivendell.uninstall(install.id, this.availability); console.log(chalk.green(`Uninstalled ${install.appId} from ${install.trackerId} (${this.availability || 'us'})`)); } catch (e) { die(formatError(e)); } } }