Skip to content

Commit 43adba9

Browse files
committed
Remove colors from output
1 parent 942b2a2 commit 43adba9

File tree

7 files changed

+30
-34
lines changed

7 files changed

+30
-34
lines changed

lib/commands/login.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function command(argv,result) {
2323
return request.request('/auth/login',{}).then(function(resp) {
2424
if (resp.type) {
2525
if (resp.type == "credentials") {
26-
prompt.read({prompt:"Username:".bold},function(err, username) {
27-
prompt.read({prompt:"Password:".bold,silent: true},function(err, password) {
26+
prompt.read({prompt:"Username:"},function(err, username) {
27+
prompt.read({prompt:"Password:",silent: true},function(err, password) {
2828
request.request('/auth/token', {
2929
method: "POST",
3030
data: {
@@ -36,7 +36,7 @@ function command(argv,result) {
3636
}
3737
}).then(function(resp) {
3838
config.tokens(resp);
39-
result.log("Logged in".green);
39+
result.log("Logged in");
4040
}).catch(function(resp) {
4141
result.warn("Login failed");
4242
});

lib/commands/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function command(argv,result) {
3535
if (info.data && info.data.length > 0) {
3636
for (var i = 0; i < info.data.length; i++) {
3737
var n = info.data[i];
38-
var label = info.data[i].name.cyan.bold + (" - " + info.data[i].description).grey;
38+
var label = info.data[i].name + " - " + info.data[i].description;
3939
var index = label.indexOf(module);
4040
matches.push({
4141
label: label,

lib/commands/target.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ function command(argv,result) {
2727
target = target.slice(0, target.length - 1);
2828
}
2929
config.target(target);
30-
30+
3131
}
32-
result.log("Target: " + config.target().cyan.bold);
32+
result.log("Target: " + config.target());
3333
}
3434

3535
command.alias = "target";

lib/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
**/
1616

1717
var config = require("./config");
18-
var colors = require("colors/safe");
1918

2019
var commands = {
2120
"target": require("./commands/target"),
@@ -33,11 +32,11 @@ var commands = {
3332
};
3433

3534
function help() {
36-
var helpText = colors.bold("Usage:") + "\n" +
35+
var helpText = "Usage:" + "\n" +
3736
" node-red-admin <command> [args] [--help] [--userDir DIR] [--json]\n\n" +
38-
colors.bold("Description:") + "\n" +
37+
"Description:" + "\n" +
3938
" Node-RED command-line client\n\n" +
40-
colors.bold("Commands:\n") +
39+
"Commands:\n" +
4140
" target - Set or view the target URL and port like http://localhost:1880\n" +
4241
" login - Log user in to the target of the Node-RED admin API\n" +
4342
" list - List all of the installed nodes\n" +

lib/result.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
var Table = require('cli-table');
1818
var util = require("util");
19-
var colors = require("colors/safe");
2019

2120
var outputFormat = "text";
2221

@@ -34,8 +33,8 @@ function logModule(result) {
3433
return;
3534
}
3635
var table = plainTable({plain:true});
37-
table.push([colors.bold("Module:"),result.name]);
38-
table.push([colors.bold("Version:"),result.version]);
36+
table.push(["Module:",result.name]);
37+
table.push(["Version:",result.version]);
3938
console.log(table.toString());
4039
console.log();
4140
logNodeList(result.nodes);
@@ -64,12 +63,12 @@ function logNodeSet(node) {
6463
}
6564
}
6665
var table = plainTable({plain:true});
67-
table.push([colors.bold("Name:"), colors.cyan(colors.bold(node.id))]);
68-
table.push([colors.bold("Module:"),node.module]);
69-
table.push([colors.bold("Version:"),node.version]);
66+
table.push(["Name:", node.id]);
67+
table.push(["Module:",node.module]);
68+
table.push(["Version:",node.version]);
7069

71-
table.push([colors.bold("Types:"), node.types.join(", ")]);
72-
table.push([colors.bold("State:"), (node.err?colors.red(node.err):(node.enabled?"enabled":"disabled"))]);
70+
table.push(["Types:", node.types.join(", ")]);
71+
table.push(["State:", (node.err?node.err:(node.enabled?"enabled":"disabled"))]);
7372

7473
console.log(table.toString());
7574
}
@@ -94,23 +93,23 @@ function logNodeList(nodes) {
9493
return 0;
9594
});
9695
var nodeTable = plainTable();
97-
nodeTable.push([colors.bold("Nodes"),colors.bold("Types"),colors.bold("State")]);
96+
nodeTable.push(["Nodes","Types","State"]);
9897

9998
for(var i=0;i<nodes.length;i++) {
10099
var node = nodes[i];
101-
var state = node.enabled?(node.err?colors.red("error"):"enabled"):colors.grey("disabled");
100+
var state = node.enabled?(node.err?"error":"enabled"):"disabled";
102101
var enabled = node.enabled&&!node.err;
103102

104103
var types = "";
105104
for (var j=0;j<node.types.length;j++) {
106-
types += (j>0?"\n":"")+(enabled?node.types[j]:colors.grey(node.types[j]));
105+
types += (j>0?"\n":"")+(enabled?node.types[j]:node.types[j]);
107106
}
108107
if (types.length === 0) {
109-
types = colors.grey("none");
108+
types = "none";
110109
}
111110

112-
nodeTable.push([enabled?colors.cyan(colors.bold(node.id)):colors.grey(node.id),
113-
enabled?types:colors.grey(types),
111+
nodeTable.push([enabled?node.id:node.id,
112+
enabled?types:types,
114113
state]);
115114
}
116115
console.log(nodeTable.toString());
@@ -150,22 +149,22 @@ module.exports = {
150149
warn:function(msg) {
151150
if (msg.response) {
152151
if (msg.response.status === 401) {
153-
console.warn("Not logged in. Use '"+colors.yellow(colors.bold("node-red-admin login"))+"' to log in.");
152+
console.warn("Not logged in. Use 'node-red-admin login' to log in.");
154153
} else if (msg.response.data) {
155-
console.warn(colors.magenta(msg.response.status+": "+msg.response.data.message));
154+
console.warn(msg.response.status+": "+msg.response.data.message);
156155
} else {
157-
console.warn(colors.magenta(msg.response.status+": "+msg.toString()));
156+
console.warn(msg.response.status+": "+msg.toString());
158157
}
159158
} else {
160-
console.warn(colors.magenta(msg.toString()));
159+
console.warn(msg.toString());
161160
}
162161
},
163162
help:function(command) {
164-
var helpText = colors.bold("Usage:") + "\n" +
163+
var helpText = "Usage:" + "\n" +
165164
" node-red-admin " + command.usage + "\n\n" +
166-
colors.bold("Description:") + "\n" +
165+
"Description:" + "\n" +
167166
" " + command.description + "\n\n" +
168-
colors.bold("Options:") + "\n" +
167+
"Options:" + "\n" +
169168
(command.options ? " " + command.options + "\n" : "") +
170169
" -h|? --help display this help text and exit";
171170
console.log(helpText);

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-admin",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"description": "The Node-RED admin command line interface",
55
"homepage": "http://nodered.org",
66
"bugs": {
@@ -31,7 +31,6 @@
3131
"axios": "0.19.2",
3232
"bcryptjs": "^2.4.3",
3333
"cli-table": "^0.3.1",
34-
"colors": "^1.4.0",
3534
"minimist": "^1.2.5",
3635
"read": "^1.0.7"
3736
},

test/lib/commands/result_helper.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
**/
16-
var colors = require("colors");
1716
var sinon = require("sinon");
1817
var result = require("../../../lib/result");
1918

0 commit comments

Comments
 (0)