MXS-2712: Add descriptions to list and show commands

The help output of all the list and show commands now explains what each
field in the output table means. The generated table will be added at the
end of the help output.

The descriptions table looks like this:

  Field         Description
  -----         -----------
  Version       MaxScale version
  Commit        MaxScale commit ID
  Started At    Time when MaxScale was started
  Activated At  Time when MaxScale left passive mode
  Uptime        Time MaxScale has been running
  Parameters    Global MaxScale parameters
This commit is contained in:
Markus Mäkelä
2019-10-08 21:40:30 +03:00
committed by Johan Wikman
parent cc1c1f9c98
commit c20c6e8406
3 changed files with 192 additions and 32 deletions

View File

@ -412,6 +412,24 @@ module.exports = function() {
this.error = function(err) {
return Promise.reject(colors.red('Error: ') + err)
}
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': '',
'bottom' : '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '',
}})
t.push(['Field', 'Description'])
t.push(['-----', '-----------'])
for (f of fields) {
t.push([f.name, f.description])
}
return '\n\n' + t.toString()
}
}
@ -431,8 +449,6 @@ var tsvopts = {
'padding-right': 0,
compact: true
},
}
function getList() {