powerbi-cli
Version:
Power BI command line interface for managing Power BI Embedded workspace collections
39 lines • 1.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var cli_1 = require("./cli");
var config_1 = require("./config");
var program = require("commander");
function CliConfig() {
var pkg = require('../package.json');
program.version(pkg.version)
.option('-c, --collection [collection]', 'The Power BI workspace collection')
.option('-w, --workspace [workspaceId]', 'The Power BI workspace')
.option('-k, --accessKey [accessKey]', 'The Power BI workspace collection access key')
.option('-b, --baseUri [baseUri]', 'The base uri to connect to')
.option('-r, --report [reportId]', 'The Power BI report id')
.option('-clear, --clear [clear]', 'Clears the settings');
program.on('--help', function () {
console.log(' Examples:');
console.log('');
console.log(' $ powerbi config -c <collection> -k <accessKey> -w <workspace> -b <baseUri> -r <reportId>');
});
program.parse(process.argv);
try {
var properties = ['collection', 'workspace', 'accessKey', 'baseUri', 'reportId'];
var currentConfig_1 = config_1.Config.get();
properties.forEach(function (key) {
if (program[key]) {
currentConfig_1[key] = program[key];
}
});
config_1.Config.set(currentConfig_1);
for (var key in currentConfig_1) {
cli_1.Cli.print('%s: %s', key, currentConfig_1[key]);
}
}
catch (err) {
cli_1.Cli.error(err);
}
}
exports.default = CliConfig;
//# sourceMappingURL=cli-config.js.map