import * as chalk from 'chalk'; import {command, help, namespace, option, param} from 'oo-cli'; import {die} from '../../lib/die'; import {formatError} from '../../lib/formatError'; import {Rivendell} from '../../lib/Rivendell'; @namespace('jobs') export class TerminateCommand { @param @help('ID of Job to terminate') private jobId!: string; @option('a') @help('The availability zone that will be targeted (default: us)') private availability: string = ''; @command @help('Terminate a job') public async terminate(): Promise { try { await Rivendell.terminateJob(this.jobId, this.availability); } catch (e: any) { die(formatError(e)); } console.log(chalk.green(`Terminated job with ID ${this.jobId} (${this.availability || 'us'}).`)); } }