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.
This commit is contained in:
@ -39,10 +39,10 @@ module.exports = function() {
|
|||||||
row = []
|
row = []
|
||||||
|
|
||||||
fields.forEach(function(p) {
|
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)) {
|
if (Array.isArray(v)) {
|
||||||
v = v.join(", ")
|
v = v.join(', ')
|
||||||
}
|
}
|
||||||
row.push(v)
|
row.push(v)
|
||||||
})
|
})
|
||||||
@ -63,10 +63,10 @@ module.exports = function() {
|
|||||||
fields.forEach(function(i) {
|
fields.forEach(function(i) {
|
||||||
var k = Object.keys(i)[0]
|
var k = Object.keys(i)[0]
|
||||||
var path = i[k]
|
var path = i[k]
|
||||||
var v = _.getPath(res.data, path, "")
|
var v = _.getPath(res.data, path, '')
|
||||||
|
|
||||||
if (Array.isArray(v) && typeof(v[0]) != 'object') {
|
if (Array.isArray(v) && typeof(v[0]) != 'object') {
|
||||||
v = v.join(", ")
|
v = v.join(', ')
|
||||||
} else if (typeof(v) == 'object') {
|
} else if (typeof(v) == 'object') {
|
||||||
v = JSON.stringify(v, null, 4)
|
v = JSON.stringify(v, null, 4)
|
||||||
}
|
}
|
||||||
@ -103,16 +103,16 @@ module.exports = function() {
|
|||||||
request(args, function(err, resp, res) {
|
request(args, function(err, resp, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// Failed to request
|
// 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) {
|
} else if (resp.statusCode == 200 && cb) {
|
||||||
// Request OK, returns data
|
// Request OK, returns data
|
||||||
cb(res)
|
cb(res)
|
||||||
} else if (resp.statusCode == 204) {
|
} else if (resp.statusCode == 204) {
|
||||||
// Request OK, no data
|
// Request OK, no data
|
||||||
console.log(colors.green("OK"))
|
console.log(colors.green('OK'))
|
||||||
} else {
|
} else {
|
||||||
// Unexpected return code, probably an error
|
// Unexpected return code, probably an error
|
||||||
console.log("Error:", resp.statusCode, resp.statusMessage)
|
console.log('Error:', resp.statusCode, resp.statusMessage)
|
||||||
if (res) {
|
if (res) {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@ exports.handler = function() {}
|
|||||||
exports.builder = function(yargs) {
|
exports.builder = function(yargs) {
|
||||||
yargs
|
yargs
|
||||||
.command('server <server> <status>', 'Clear server status', {}, function(argv) {
|
.command('server <server> <status>', 'Clear server status', {}, function(argv) {
|
||||||
var target = 'servers/' + argv.server + "/clear?status=" + argv.status
|
var target = 'servers/' + argv.server + '/clear?status=' + argv.status
|
||||||
doRequest(target, null, {method: "POST"})
|
doRequest(target, null, {method: 'POST'})
|
||||||
})
|
})
|
||||||
.usage("Usage: clear <command>")
|
.usage('Usage: clear <command>')
|
||||||
.help()
|
.help()
|
||||||
.command('*', 'the default command', {}, () => {
|
.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.')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -65,9 +65,9 @@ exports.builder = function(yargs) {
|
|||||||
{'Version': 'attributes.version'}
|
{'Version': 'attributes.version'}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
.usage("Usage: list <command>")
|
.usage('Usage: list <command>')
|
||||||
.help()
|
.help()
|
||||||
.command('*', 'the default command', {}, () => {
|
.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.')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@ exports.handler = function() {}
|
|||||||
exports.builder = function(yargs) {
|
exports.builder = function(yargs) {
|
||||||
yargs
|
yargs
|
||||||
.command('server <server> <status>', 'Set server status', {}, function(argv) {
|
.command('server <server> <status>', 'Set server status', {}, function(argv) {
|
||||||
var target = 'servers/' + argv.server + "/set?status=" + argv.status
|
var target = 'servers/' + argv.server + '/set?status=' + argv.status
|
||||||
doRequest(target, null, {method: "POST"})
|
doRequest(target, null, {method: 'POST'})
|
||||||
})
|
})
|
||||||
.usage("Usage: set <command>")
|
.usage('Usage: set <command>')
|
||||||
.help()
|
.help()
|
||||||
.command('*', 'the default command', {}, () => {
|
.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.')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -83,9 +83,9 @@ exports.builder = function(yargs) {
|
|||||||
{'Commands': 'attributes.commands'}
|
{'Commands': 'attributes.commands'}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
.usage("Usage: show <command>")
|
.usage('Usage: show <command>')
|
||||||
.help()
|
.help()
|
||||||
.command('*', 'the default command', {}, () => {
|
.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.')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,6 @@ program
|
|||||||
.help()
|
.help()
|
||||||
.demandCommand(1, 'At least one command is required')
|
.demandCommand(1, 'At least one command is required')
|
||||||
.command('*', 'the default command', {}, () => {
|
.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
|
.argv
|
||||||
|
Reference in New Issue
Block a user