skysync-cli
Version:
SkySync Command Line Interface
46 lines (45 loc) • 1.7 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const command_1 = require("../../util/command");
const outputFormat = {
table: [
{
header: 'ID',
property: 'id'
},
{
header: 'Name',
property: 'name'
},
{
header: 'Enabled',
property: 'disabled',
transform: val => val ? 'N' : 'Y'
}
],
json: [
'features'
]
};
module.exports = {
command: 'platforms [id]',
desc: 'List available platforms',
handler: argv => {
command_1.runCommand(argv, (client, output) => __awaiter(void 0, void 0, void 0, function* () {
if (argv.id) {
const platform = yield client.storagePlatforms.get(argv.id);
return output.writeItem(platform, outputFormat);
}
const platforms = yield client.storagePlatforms.list();
output.writeTable(platforms, outputFormat);
}));
}
};