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('service <name>', 'Start a service', function(yargs) {
return yargs.epilog('This starts a service stopped by `stop service <name>`');
return yargs.epilog('This starts a service stopped by `stop service <name>`')
.usage('Usage: start service <name>')
}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'services/' + argv.name + '/start', null, {method: 'PUT'})
})
})
.command('monitor <name>', 'Start a monitor', function(yargs) {
return yargs.epilog('This starts a monitor stopped by `stop monitor <name>`');
return yargs.epilog('This starts a monitor stopped by `stop monitor <name>`')
.usage('Usage: start monitor <name>')
}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'monitors/' + argv.name + '/start', null, {method: 'PUT'})
@ -33,7 +35,8 @@ exports.builder = function(yargs) {
})
.command('maxscale', 'Start MaxScale by starting all services', function(yargs) {
return yargs.epilog('This command will execute the `start service` command for ' +
'all services in MaxScale.');
'all services in MaxScale.')
.usage('Usage: start maxscale')
}, function(argv) {
maxctrl(argv, function(host) {
return doRequest(host, 'services/', function(res) {