Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down
3 changes: 2 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)")
);
}
);
Expand All @@ -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)}`));
}
};

Expand Down
9 changes: 5 additions & 4 deletions lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -68,11 +69,11 @@ class Init {
let instance = this;
let data = `
const ${providers.require} = require('${providers.package}');

const providers = [
${providers.provider}
];

module.exports = providers;
`;

Expand Down Expand Up @@ -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);
Expand Down