ryuu
Version:
Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo
65 lines • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var login_1 = require("../util/login");
var log_1 = require("../util/log");
var chalk = require("chalk");
module.exports = function (program) {
program
.command('ls')
.description('get a list of all your Custom App designs')
.option('-a, --all', 'List all designs on current instance (admin role required)')
.option('-d, --deleted', 'Include deleted designs on current instance')
.action(function (options) {
var _a, _b;
var params = {
deleted: (_a = options.deleted) !== null && _a !== void 0 ? _a : false,
checkAdminAuthority: (_b = options.all) !== null && _b !== void 0 ? _b : false,
};
new login_1.Login().getClient().then(function (client) {
client
.getDesigns(params)
.then(function (designs) {
if (designs.length === 0) {
log_1.log.fail('No Designs Published', "`domo ls` will list designs once they're published to Domo");
}
var windowWidth = process.stdout.columns;
if (windowWidth >= 130) {
var Table = require('cli-table');
// instantiate
var table_1 = new Table({
head: [
chalk.cyan('Design Name'),
chalk.cyan('Design Id'),
chalk.cyan('Date Created'),
chalk.cyan('Last Updated'),
],
colWidths: [windowWidth - 105, 38, 31, 31],
});
designs.forEach(function (design) {
table_1.push([
design.name,
design.id,
new Date(design.createdDate).toUTCString(),
new Date(design.updatedDate).toUTCString(),
]);
});
console.log(table_1.toString());
}
else {
designs.forEach(function (design) {
console.log('Design Name: ' + design.name);
console.log('Design Id: ' + design.id);
console.log('Date Created: ' + new Date(design.createdDate).toUTCString());
console.log('Last Updated: ' +
new Date(design.updatedDate).toUTCString() +
'\n');
});
}
})
.catch(function (e) {
log_1.log.fail('Unable to fetch designs', 'You may not have any designs published yet.');
});
});
});
};
//# sourceMappingURL=ls.js.map