From 6955be901fd9efcb288bba7b8504ec9296e007d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Jun 2017 15:37:35 +0300 Subject: [PATCH] MXS-1300: Use single quotes in Node.js code The Node.js code should use single quotes as it appears to be a prevalent style choice for Node.js applications. --- client/maxctrl/common.js | 14 +++++++------- client/maxctrl/lib/clear.js | 8 ++++---- client/maxctrl/lib/list.js | 4 ++-- client/maxctrl/lib/set.js | 8 ++++---- client/maxctrl/lib/show.js | 4 ++-- client/maxctrl/maxctrl.js | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/client/maxctrl/common.js b/client/maxctrl/common.js index 606b492d2..85a0833ca 100644 --- a/client/maxctrl/common.js +++ b/client/maxctrl/common.js @@ -39,10 +39,10 @@ module.exports = function() { row = [] fields.forEach(function(p) { - var v = _.getPath(i, p[Object.keys(p)[0]], "") + var v = _.getPath(i, p[Object.keys(p)[0]], '') if (Array.isArray(v)) { - v = v.join(", ") + v = v.join(', ') } row.push(v) }) @@ -63,10 +63,10 @@ module.exports = function() { fields.forEach(function(i) { var k = Object.keys(i)[0] var path = i[k] - var v = _.getPath(res.data, path, "") + var v = _.getPath(res.data, path, '') if (Array.isArray(v) && typeof(v[0]) != 'object') { - v = v.join(", ") + v = v.join(', ') } else if (typeof(v) == 'object') { v = JSON.stringify(v, null, 4) } @@ -103,16 +103,16 @@ module.exports = function() { request(args, function(err, resp, res) { if (err) { // Failed to request - console.log("Error:", JSON.stringify(err, null, 4)) + console.log('Error:', JSON.stringify(err, null, 4)) } else if (resp.statusCode == 200 && cb) { // Request OK, returns data cb(res) } else if (resp.statusCode == 204) { // Request OK, no data - console.log(colors.green("OK")) + console.log(colors.green('OK')) } else { // Unexpected return code, probably an error - console.log("Error:", resp.statusCode, resp.statusMessage) + console.log('Error:', resp.statusCode, resp.statusMessage) if (res) { console.log(res) } diff --git a/client/maxctrl/lib/clear.js b/client/maxctrl/lib/clear.js index 9e62ba678..a7e8d981d 100644 --- a/client/maxctrl/lib/clear.js +++ b/client/maxctrl/lib/clear.js @@ -18,12 +18,12 @@ exports.handler = function() {} exports.builder = function(yargs) { yargs .command('server ', 'Clear server status', {}, function(argv) { - var target = 'servers/' + argv.server + "/clear?status=" + argv.status - doRequest(target, null, {method: "POST"}) + var target = 'servers/' + argv.server + '/clear?status=' + argv.status + doRequest(target, null, {method: 'POST'}) }) - .usage("Usage: clear ") + .usage('Usage: clear ') .help() .command('*', 'the default command', {}, () => { - console.log("Unknown command. See output of 'help clear' for a list of commands.") + console.log('Unknown command. See output of `help clear` for a list of commands.') }) } diff --git a/client/maxctrl/lib/list.js b/client/maxctrl/lib/list.js index 8d1ba4e44..d60fe0463 100644 --- a/client/maxctrl/lib/list.js +++ b/client/maxctrl/lib/list.js @@ -65,9 +65,9 @@ exports.builder = function(yargs) { {'Version': 'attributes.version'} ]) }) - .usage("Usage: list ") + .usage('Usage: list ') .help() .command('*', 'the default command', {}, () => { - console.log("Unknown command. See output of 'help list' for a list of commands.") + console.log('Unknown command. See output of `help list` for a list of commands.') }) } diff --git a/client/maxctrl/lib/set.js b/client/maxctrl/lib/set.js index 30e67c552..b53d33b92 100644 --- a/client/maxctrl/lib/set.js +++ b/client/maxctrl/lib/set.js @@ -18,12 +18,12 @@ exports.handler = function() {} exports.builder = function(yargs) { yargs .command('server ', 'Set server status', {}, function(argv) { - var target = 'servers/' + argv.server + "/set?status=" + argv.status - doRequest(target, null, {method: "POST"}) + var target = 'servers/' + argv.server + '/set?status=' + argv.status + doRequest(target, null, {method: 'POST'}) }) - .usage("Usage: set ") + .usage('Usage: set ') .help() .command('*', 'the default command', {}, () => { - console.log("Unknown command. See output of 'help set' for a list of commands.") + console.log('Unknown command. See output of `help set` for a list of commands.') }) } diff --git a/client/maxctrl/lib/show.js b/client/maxctrl/lib/show.js index ceb68a8c5..2ded44860 100644 --- a/client/maxctrl/lib/show.js +++ b/client/maxctrl/lib/show.js @@ -83,9 +83,9 @@ exports.builder = function(yargs) { {'Commands': 'attributes.commands'} ]) }) - .usage("Usage: show ") + .usage('Usage: show ') .help() .command('*', 'the default command', {}, () => { - console.log("Unknown command. See output of 'help show' for a list of commands.") + console.log('Unknown command. See output of `help show` for a list of commands.') }) } diff --git a/client/maxctrl/maxctrl.js b/client/maxctrl/maxctrl.js index af9cd34e6..6e2c64a05 100644 --- a/client/maxctrl/maxctrl.js +++ b/client/maxctrl/maxctrl.js @@ -57,6 +57,6 @@ program .help() .demandCommand(1, 'At least one command is required') .command('*', 'the default command', {}, () => { - console.log("Unknown command. See output of 'help' for a list of commands.") + console.log('Unknown command. See output of `help` for a list of commands.') }) .argv