diff --git a/README.md b/README.md index bb74340..730e530 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ nodecloud-cli is an unified command line interface for open cloud based on [node ## 🚀 Install +> If the output is RED color, It means there is an error + +> If the output is GREEN color, It means the process was successful + Using npm ``` diff --git a/lib/config.js b/lib/config.js index 4fb1fcf..245269b 100644 --- a/lib/config.js +++ b/lib/config.js @@ -2,11 +2,12 @@ const fs = require("fs"); const emoji = require("node-emoji"); const detectInstalled = require("detect-installed"); const { exec } = require("child_process"); +const clc = require("cli-color"); function installDependencies(path, cb) { exec(`cd ${path} && npm install`, (error, stdout, stderr) => { if (error) { - console.log("error", error); + console.log(clc.red("error", error)); cb(error, null); } cb(null, true); diff --git a/lib/helper.js b/lib/helper.js index 4269c36..38fe5bd 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -3,6 +3,7 @@ const fs = require("fs"); const figlet = require("figlet"); const chalk = require("chalk"); const path = "./.nc.config.js"; +const clc = require("cli-color"); /** * Display text as CLI logo @@ -21,10 +22,10 @@ let logofied = text => { logger(err, true); return; } - console.log(chalk.blue(data)); + console.log(clc.green); console.log( - chalk.green("Sustainable Computing Research Group") + - chalk.blue(" (SCoRe)") + clc.green("Sustainable Computing Research Group") + + clc.green(" (SCoRe)") ); } ); @@ -37,9 +38,9 @@ let logofied = text => { */ let logger = (data, error) => { if (error) { - console.log(chalk.red(`${JSON.stringify(data, null, 2)}`)); + console.log(clc.red(`${JSON.stringify(data, null, 2)}`)); } else { - console.log(chalk.green(`${JSON.stringify(data, null, 2)}`)); + console.log(clc.green(`${JSON.stringify(data, null, 2)}`)); } }; diff --git a/lib/init.js b/lib/init.js index 39efc5a..f18d69a 100644 --- a/lib/init.js +++ b/lib/init.js @@ -3,6 +3,7 @@ const npm = require("npm-programmatic"); const inquirer = require("inquirer"); const { getRegion } = require("./regions"); const { checkPlugin, logofied } = require("./helper"); +const clc = require("cli-color"); const questions = []; @@ -68,11 +69,11 @@ class Init { let instance = this; let data = ` const ${providers.require} = require('${providers.package}'); - + const providers = [ ${providers.provider} ]; - + module.exports = providers; `; @@ -191,9 +192,9 @@ class Init { } ]) .then(answers => { - console.log("provider", this._provider); + console.log(clc.green("provider", this._provider)); - console.log("regions", answers.regions); + console.log(clc.green("regions", answers.regions)); }) .catch(err => { this._spinner.fail(err);