Add explicit usage to each command

The yargs framework combined with the pkg packaging causes the executable
name to be mangled on installation. For this reason, the usage should be
explicitly added to each command.
This commit is contained in:
Markus Mäkelä
2017-09-28 12:40:51 +03:00
parent c2283bbff1
commit f102a563e9
16 changed files with 102 additions and 51 deletions

View File

@ -18,14 +18,16 @@ exports.handler = function() {}
exports.builder = function(yargs) {
yargs
.command('server <name>', 'Destroy an unused server', function(yargs) {
return yargs.epilog('The server must be unlinked from all services and monitor before it can be destroyed.');
return yargs.epilog('The server must be unlinked from all services and monitor before it can be destroyed.')
.usage('Usage: destroy server <name>')
}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'servers/' + argv.name, null, {method: 'DELETE'})
})
})
.command('monitor <name>', 'Destroy an unused monitor', function(yargs) {
return yargs.epilog('The monitor must be unlinked from all servers before it can be destroyed.');
return yargs.epilog('The monitor must be unlinked from all servers before it can be destroyed.')
.usage('Usage: destroy monitor <name>')
}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'monitors/' + argv.name, null, {method: 'DELETE'})
@ -36,7 +38,8 @@ exports.builder = function(yargs) {
'Destroying a listener at runtime stops it from accepting new ' +
'connections but it will still be bound to the listening socket. This ' +
'means that new listeners cannot be created to replace destroyed listeners ' +
'without restarting MaxScale.');
'without restarting MaxScale.')
.usage('Usage: destroy listener <service> <name>')
}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'services/' + argv.service + '/listeners/' + argv.name, null, {method: 'DELETE'})
@ -45,7 +48,8 @@ exports.builder = function(yargs) {
.command('user <name>', 'Remove a network user', function(yargs) {
return yargs.epilog('The last remaining administrative user cannot be removed. ' +
'Create a replacement administrative user before attempting ' +
'to remove the last administrative user.');
'to remove the last administrative user.')
.usage('Usage: destroy user <name>')
}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'users/inet/' + argv.name, null, {method: 'DELETE'})