@liara/cli
Version:
The command line interface for Liara
16 lines (15 loc) • 455 B
JavaScript
import inquirer from 'inquirer';
export async function promptVMs(vms) {
const { selectedVm } = (await inquirer.prompt({
name: 'selectedVm',
type: 'list',
message: `Please select a vm:`,
choices: [
...vms.map((vm) => ({
name: `${vm.name} \x1b[34m(${vm.OS})\x1b[0m`,
value: vm._id,
})),
],
}));
return vms.filter((vm) => vm._id == selectedVm)[0];
}