MXS-2712: Fix field description generation

Longer descriptions broke the formatting. The output is now also formatted
as a Markdown table which makes it work in the generated documentation.
This commit is contained in:
Markus Mäkelä 2019-10-11 11:08:49 +03:00
parent 183673b026
commit fd7d435f71
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 25 additions and 7 deletions

View File

@ -415,8 +415,8 @@ module.exports = function() {
this.fieldDescriptions = function(fields) {
var t = new Table({chars: {
'top' : '', 'top-mid': '', 'top-left': '', 'top-right': '', 'left': ' ', 'right': '',
'left-mid': '' , 'mid': '' , 'mid-mid': '', 'right-mid': '' , 'middle': '',
'top' : ' ', 'top-mid': '', 'top-left': '', 'top-right': '', 'left': ' ', 'right': '',
'left-mid': '' , 'mid': '' , 'mid-mid': '', 'right-mid': '' , 'middle': '|',
'bottom' : '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '',
}})

View File

@ -458,6 +458,7 @@ exports.builder = function(yargs) {
'field contains the currently configured parameters for this ' +
'server. See `help alter server` for more details about altering ' +
'server parameters.' + fieldDescriptions(server_fields))
.wrap(null)
.usage('Usage: show server <server>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -467,6 +468,7 @@ exports.builder = function(yargs) {
.command('servers', 'Show all servers', function(yargs) {
return yargs.epilog('Show detailed information about all servers.' +
fieldDescriptions(server_fields))
.wrap(null)
.usage('Usage: show servers')
}, function(argv) {
maxctrl(argv, function(host) {
@ -478,6 +480,7 @@ exports.builder = function(yargs) {
'field contains the currently configured parameters for this ' +
'service. See `help alter service` for more details about altering ' +
'service parameters.' + fieldDescriptions(service_fields))
.wrap(null)
.usage('Usage: show service <service>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -487,6 +490,7 @@ exports.builder = function(yargs) {
.command('services', 'Show all services', function(yargs) {
return yargs.epilog('Show detailed information about all services.' +
fieldDescriptions(service_fields))
.wrap(null)
.usage('Usage: show services')
}, function(argv) {
maxctrl(argv, function(host) {
@ -498,6 +502,7 @@ exports.builder = function(yargs) {
'field contains the currently configured parameters for this ' +
'monitor. See `help alter monitor` for more details about altering ' +
'monitor parameters.' + fieldDescriptions(monitor_fields))
.wrap(null)
.usage('Usage: show monitor <monitor>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -507,6 +512,7 @@ exports.builder = function(yargs) {
.command('monitors', 'Show all monitors', function(yargs) {
return yargs.epilog('Show detailed information about all monitors.' +
fieldDescriptions(monitor_fields))
.wrap(null)
.usage('Usage: show monitors')
}, function(argv) {
maxctrl(argv, function(host) {
@ -522,6 +528,7 @@ exports.builder = function(yargs) {
'the session is connected and the `Connection IDs` ' +
'field lists the IDs for those connections.' +
fieldDescriptions(session_fields))
.wrap(null)
.usage('Usage: show session <session>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -532,6 +539,7 @@ exports.builder = function(yargs) {
return yargs.epilog('Show detailed information about all sessions. ' +
'See `help show session` for more details.' +
fieldDescriptions(session_fields))
.wrap(null)
.usage('Usage: show sessions')
}, function(argv) {
maxctrl(argv, function(host) {
@ -540,7 +548,8 @@ exports.builder = function(yargs) {
})
.command('filter <filter>', 'Show filter', function(yargs) {
return yargs.epilog('The list of services that use this filter is show in the `Services` field.' +
fieldDescriptions(filter_fields))
fieldDescriptions(filter_fields))
.wrap(null)
.usage('Usage: show filter <filter>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -550,6 +559,7 @@ exports.builder = function(yargs) {
.command('filters', 'Show all filters', function(yargs) {
return yargs.epilog('Show detailed information of all filters.' +
fieldDescriptions(filter_fields))
.wrap(null)
.usage('Usage: show filters')
}, function(argv) {
maxctrl(argv, function(host) {
@ -559,7 +569,8 @@ exports.builder = function(yargs) {
.command('module <module>', 'Show loaded module', function(yargs) {
return yargs.epilog('This command shows all available parameters as well as ' +
'detailed version information of a loaded module.' +
fieldDescriptions(module_fields))
fieldDescriptions(module_fields))
.wrap(null)
.usage('Usage: show module <module>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -568,7 +579,8 @@ exports.builder = function(yargs) {
})
.command('modules', 'Show all loaded modules', function(yargs) {
return yargs.epilog('Displays detailed information about all modules.' +
fieldDescriptions(module_fields))
fieldDescriptions(module_fields))
.wrap(null)
.usage('Usage: show modules')
}, function(argv) {
maxctrl(argv, function(host) {
@ -578,6 +590,7 @@ exports.builder = function(yargs) {
.command('maxscale', 'Show MaxScale information', function(yargs) {
return yargs.epilog('See `help alter maxscale` for more details about altering ' +
'MaxScale parameters.' + fieldDescriptions(show_maxscale_fields))
.wrap(null)
.usage('Usage: show maxscale')
}, function(argv) {
maxctrl(argv, function(host) {
@ -586,7 +599,8 @@ exports.builder = function(yargs) {
})
.command('thread <thread>', 'Show thread', function(yargs) {
return yargs.epilog('Show detailed information about a worker thread.' +
fieldDescriptions(thread_fields))
fieldDescriptions(thread_fields))
.wrap(null)
.usage('Usage: show thread <thread>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -595,7 +609,8 @@ exports.builder = function(yargs) {
})
.command('threads', 'Show all threads', function(yargs) {
return yargs.epilog('Show detailed information about all worker threads.' +
fieldDescriptions(thread_fields))
fieldDescriptions(thread_fields))
.wrap(null)
.usage('Usage: show threads')
}, function(argv) {
maxctrl(argv, function(host) {
@ -605,6 +620,7 @@ exports.builder = function(yargs) {
.command('logging', 'Show MaxScale logging information', function(yargs) {
return yargs.epilog('See `help alter logging` for more details about altering ' +
'logging parameters.' + fieldDescriptions(show_logging_fields))
.wrap(null)
.usage('Usage: show logging')
}, function(argv) {
maxctrl(argv, function(host) {
@ -614,6 +630,7 @@ exports.builder = function(yargs) {
.command('commands <module>', 'Show module commands of a module', function(yargs) {
return yargs.epilog('This command shows the parameters the command expects with ' +
'the parameter descriptions.' + fieldDescriptions(show_commands_fields))
.wrap(null)
.usage('Usage: show commands <module>')
}, function(argv) {
maxctrl(argv, function(host) {
@ -621,6 +638,7 @@ exports.builder = function(yargs) {
show_commands_fields)
})
})
.wrap(null)
.usage('Usage: show <command>')
.help()
.command('*', 'the default command', {}, function(argv) {