diff --git a/lib/commands/login.js b/lib/commands/login.js index 897ea33..fb704f9 100644 --- a/lib/commands/login.js +++ b/lib/commands/login.js @@ -23,8 +23,8 @@ function command(argv,result) { return request.request('/auth/login',{}).then(function(resp) { if (resp.type) { if (resp.type == "credentials") { - prompt.read({prompt:"Username:".bold},function(err, username) { - prompt.read({prompt:"Password:".bold,silent: true},function(err, password) { + prompt.read({prompt:"Username:"},function(err, username) { + prompt.read({prompt:"Password:",silent: true},function(err, password) { request.request('/auth/token', { method: "POST", data: { @@ -36,7 +36,7 @@ function command(argv,result) { } }).then(function(resp) { config.tokens(resp); - result.log("Logged in".green); + result.log("Logged in"); }).catch(function(resp) { result.warn("Login failed"); }); diff --git a/lib/commands/search.js b/lib/commands/search.js index 06b0fb3..733e759 100644 --- a/lib/commands/search.js +++ b/lib/commands/search.js @@ -35,7 +35,7 @@ function command(argv,result) { if (info.data && info.data.length > 0) { for (var i = 0; i < info.data.length; i++) { var n = info.data[i]; - var label = info.data[i].name.cyan.bold + (" - " + info.data[i].description).grey; + var label = info.data[i].name + " - " + info.data[i].description; var index = label.indexOf(module); matches.push({ label: label, diff --git a/lib/commands/target.js b/lib/commands/target.js index 9094e40..efee2ac 100644 --- a/lib/commands/target.js +++ b/lib/commands/target.js @@ -27,9 +27,9 @@ function command(argv,result) { target = target.slice(0, target.length - 1); } config.target(target); - + } - result.log("Target: " + config.target().cyan.bold); + result.log("Target: " + config.target()); } command.alias = "target"; diff --git a/lib/index.js b/lib/index.js index 30c524a..e0e917d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -15,7 +15,6 @@ **/ var config = require("./config"); -var colors = require("colors/safe"); var commands = { "target": require("./commands/target"), @@ -33,11 +32,11 @@ var commands = { }; function help() { - var helpText = colors.bold("Usage:") + "\n" + + var helpText = "Usage:" + "\n" + " node-red-admin [args] [--help] [--userDir DIR] [--json]\n\n" + - colors.bold("Description:") + "\n" + + "Description:" + "\n" + " Node-RED command-line client\n\n" + - colors.bold("Commands:\n") + + "Commands:\n" + " target - Set or view the target URL and port like http://localhost:1880\n" + " login - Log user in to the target of the Node-RED admin API\n" + " list - List all of the installed nodes\n" + diff --git a/lib/result.js b/lib/result.js index a9df917..0fa9d4c 100644 --- a/lib/result.js +++ b/lib/result.js @@ -16,7 +16,6 @@ var Table = require('cli-table'); var util = require("util"); -var colors = require("colors/safe"); var outputFormat = "text"; @@ -34,8 +33,8 @@ function logModule(result) { return; } var table = plainTable({plain:true}); - table.push([colors.bold("Module:"),result.name]); - table.push([colors.bold("Version:"),result.version]); + table.push(["Module:",result.name]); + table.push(["Version:",result.version]); console.log(table.toString()); console.log(); logNodeList(result.nodes); @@ -64,12 +63,12 @@ function logNodeSet(node) { } } var table = plainTable({plain:true}); - table.push([colors.bold("Name:"), colors.cyan(colors.bold(node.id))]); - table.push([colors.bold("Module:"),node.module]); - table.push([colors.bold("Version:"),node.version]); + table.push(["Name:", node.id]); + table.push(["Module:",node.module]); + table.push(["Version:",node.version]); - table.push([colors.bold("Types:"), node.types.join(", ")]); - table.push([colors.bold("State:"), (node.err?colors.red(node.err):(node.enabled?"enabled":"disabled"))]); + table.push(["Types:", node.types.join(", ")]); + table.push(["State:", (node.err?node.err:(node.enabled?"enabled":"disabled"))]); console.log(table.toString()); } @@ -94,23 +93,23 @@ function logNodeList(nodes) { return 0; }); var nodeTable = plainTable(); - nodeTable.push([colors.bold("Nodes"),colors.bold("Types"),colors.bold("State")]); + nodeTable.push(["Nodes","Types","State"]); for(var i=0;i0?"\n":"")+(enabled?node.types[j]:colors.grey(node.types[j])); + types += (j>0?"\n":"")+(enabled?node.types[j]:node.types[j]); } if (types.length === 0) { - types = colors.grey("none"); + types = "none"; } - nodeTable.push([enabled?colors.cyan(colors.bold(node.id)):colors.grey(node.id), - enabled?types:colors.grey(types), + nodeTable.push([enabled?node.id:node.id, + enabled?types:types, state]); } console.log(nodeTable.toString()); @@ -150,22 +149,22 @@ module.exports = { warn:function(msg) { if (msg.response) { if (msg.response.status === 401) { - console.warn("Not logged in. Use '"+colors.yellow(colors.bold("node-red-admin login"))+"' to log in."); + console.warn("Not logged in. Use 'node-red-admin login' to log in."); } else if (msg.response.data) { - console.warn(colors.magenta(msg.response.status+": "+msg.response.data.message)); + console.warn(msg.response.status+": "+msg.response.data.message); } else { - console.warn(colors.magenta(msg.response.status+": "+msg.toString())); + console.warn(msg.response.status+": "+msg.toString()); } } else { - console.warn(colors.magenta(msg.toString())); + console.warn(msg.toString()); } }, help:function(command) { - var helpText = colors.bold("Usage:") + "\n" + + var helpText = "Usage:" + "\n" + " node-red-admin " + command.usage + "\n\n" + - colors.bold("Description:") + "\n" + + "Description:" + "\n" + " " + command.description + "\n\n" + - colors.bold("Options:") + "\n" + + "Options:" + "\n" + (command.options ? " " + command.options + "\n" : "") + " -h|? --help display this help text and exit"; console.log(helpText); diff --git a/package.json b/package.json index 62c95f6..729b0ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-admin", - "version": "0.2.2", + "version": "0.2.3", "description": "The Node-RED admin command line interface", "homepage": "http://nodered.org", "bugs": { @@ -31,7 +31,6 @@ "axios": "0.19.2", "bcryptjs": "^2.4.3", "cli-table": "^0.3.1", - "colors": "^1.4.0", "minimist": "^1.2.5", "read": "^1.0.7" }, diff --git a/test/lib/commands/result_helper.js b/test/lib/commands/result_helper.js index 8907c5b..0846012 100644 --- a/test/lib/commands/result_helper.js +++ b/test/lib/commands/result_helper.js @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -var colors = require("colors"); var sinon = require("sinon"); var result = require("../../../lib/result");