MXS-3016: Rename --monitors to --monitor

Renamed the option and changed the type to a string argument. The alias
for --monitors still allows old code to use the same format.
This commit is contained in:
Markus Mäkelä
2020-06-01 09:20:46 +03:00
parent 0f1f9426c3
commit ce437bc779

View File

@ -83,9 +83,10 @@ exports.builder = function(yargs) {
describe: 'Link the created server to these services. All non-option arguments after --services are interpreted as service names e.g. `--services my-service-1 my-service-2`.', describe: 'Link the created server to these services. All non-option arguments after --services are interpreted as service names e.g. `--services my-service-1 my-service-2`.',
type: 'array' type: 'array'
}) })
.option('monitors', { .option('monitor', {
alias: 'monitors',
describe: 'Link the created server to this monitor', describe: 'Link the created server to this monitor',
type: 'array' type: 'string'
}) })
.command('server <name> <host> <port>', 'Create a new server', function(yargs) { .command('server <name> <host> <port>', 'Create a new server', function(yargs) {
return yargs.epilog('The created server will not be used by any services or monitors ' + return yargs.epilog('The created server will not be used by any services or monitors ' +
@ -121,10 +122,8 @@ exports.builder = function(yargs) {
} }
} }
if (argv.monitors) { if (argv.monitor) {
for (i = 0; i < argv.monitors.length; i++) { _.set(server, 'data.relationships.monitors.data[0]', {id: argv.monitor, type: 'monitors'})
_.set(server, 'data.relationships.monitors.data[' + i + ']', {id: argv.monitors[i], type: 'monitors'})
}
} }
maxctrl(argv, function(host) { maxctrl(argv, function(host) {