MXS-1300: Make output optional

Minor refactoring to the core library to allow multiple calls from within
the same program.

Added --quiet option to silence output so that tests aren't so
verbose. Currently this only works on UNIX based systems.
This commit is contained in:
Markus Mäkelä
2017-07-14 16:36:59 +03:00
parent ec5b0fea39
commit d938dcc701
18 changed files with 116 additions and 89 deletions

View File

@ -40,6 +40,6 @@ exports.builder = function(yargs) {
.usage('Usage: alter <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help alter` for a list of commands.')
logger.log('Unknown command. See output of `help alter` for a list of commands.')
})
}

View File

@ -35,13 +35,13 @@ exports.builder = function(yargs) {
return maxctrl
.doAsyncRequest('maxscale/modules/' + argv.module + '/' + argv.command + '?' + argv.parameters.join('&'),
function(resp) {
console.log(JSON.stringify(resp, null, 4))
logger.log(JSON.stringify(resp, null, 4))
}, { method: verb })
})
})
.usage('Usage: call <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help call` for a list of commands.')
logger.log('Unknown command. See output of `help call` for a list of commands.')
})
}

View File

@ -25,6 +25,6 @@ exports.builder = function(yargs) {
.usage('Usage: clear <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help clear` for a list of commands.')
logger.log('Unknown command. See output of `help clear` for a list of commands.')
})
}

View File

@ -181,6 +181,6 @@ exports.builder = function(yargs) {
.usage('Usage: create <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help create` for a list of commands.')
logger.log('Unknown command. See output of `help create` for a list of commands.')
})
}

View File

@ -36,6 +36,6 @@ exports.builder = function(yargs) {
.usage('Usage: destroy <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help destroy` for a list of commands.')
logger.log('Unknown command. See output of `help destroy` for a list of commands.')
})
}

View File

@ -48,6 +48,6 @@ exports.builder = function(yargs) {
.usage('Usage: disable <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help disable` for a list of commands.')
logger.log('Unknown command. See output of `help disable` for a list of commands.')
})
}

View File

@ -54,6 +54,6 @@ exports.builder = function(yargs) {
.usage('Usage: enable <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help enable` for a list of commands.')
logger.log('Unknown command. See output of `help enable` for a list of commands.')
})
}

View File

@ -44,6 +44,6 @@ exports.builder = function(yargs) {
.usage('Usage: link <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help link` for a list of commands.')
logger.log('Unknown command. See output of `help link` for a list of commands.')
})
}

View File

@ -87,6 +87,6 @@ exports.builder = function(yargs) {
.usage('Usage: list <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help list` for a list of commands.')
logger.log('Unknown command. See output of `help list` for a list of commands.')
})
}

View File

@ -24,6 +24,6 @@ exports.builder = function(yargs) {
.usage('Usage: rotate <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help rotate` for a list of commands.')
logger.log('Unknown command. See output of `help rotate` for a list of commands.')
})
}

View File

@ -25,6 +25,6 @@ exports.builder = function(yargs) {
.usage('Usage: set <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help set` for a list of commands.')
logger.log('Unknown command. See output of `help set` for a list of commands.')
})
}

View File

@ -111,6 +111,6 @@ exports.builder = function(yargs) {
.usage('Usage: show <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help show` for a list of commands.')
logger.log('Unknown command. See output of `help show` for a list of commands.')
})
}

View File

@ -28,6 +28,6 @@ exports.builder = function(yargs) {
.usage('Usage: start <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help start` for a list of commands.')
logger.log('Unknown command. See output of `help start` for a list of commands.')
})
}

View File

@ -28,6 +28,6 @@ exports.builder = function(yargs) {
.usage('Usage: stop <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help stop` for a list of commands.')
logger.log('Unknown command. See output of `help stop` for a list of commands.')
})
}

View File

@ -44,6 +44,6 @@ exports.builder = function(yargs) {
.usage('Usage: unlink <command>')
.help()
.command('*', 'the default command', {}, () => {
console.log('Unknown command. See output of `help unlink` for a list of commands.')
logger.log('Unknown command. See output of `help unlink` for a list of commands.')
})
}