UNPKG

cloudcms-cli

Version:
50 lines (42 loc) 1.37 kB
var helper = require("../../../helper"); var AbstractCommand = require("../../abstract"); class DownloadLogCommand extends AbstractCommand { constructor() { super({ "group": "log", "name": "download", "description": "Downloads the log file for your platform", "schema": { "properties": [{ "name": "project", "type": "string", "description": "Enter the project ID", "required": false, "args": ["project"] }] } }); } handle(options, callback) { var params = {}; if (options.project) { return helper.appConnect(function(err) { this.readProject(options.project).then(function() { var stackId = this.stackId; helper._handleGitanaGetText("/stacks/" + stackId + "/logs/logfile", params, function(err, text) { helper.print("" + text); }); }); }); } // otherwise, get platform level log helper._handleGitanaGetText("/logs/logfile", params, function(err, text) { helper.print("" + text); }); } } module.exports = DownloadLogCommand;