diff --git a/lib/cli.js b/lib/cli.js index ddd9c5b4..c1b58d96 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -15,7 +15,7 @@ program .version(pkg.version) program - .command('provider [serial..]') + .command('provider [serial...]') .description('start provider') .option('-s, --connect-sub ' , 'sub endpoint' @@ -76,10 +76,7 @@ program , 'whether to mute master volume when devices are being used') .option('--lock-rotation' , 'whether to lock rotation when devices are being used') - .action(function() { - var serials = cliutil.allUnknownArgs(arguments) - , options = cliutil.lastArg(arguments) - + .action(function(serials, options) { if (!options.connectSub) { this.missingArgument('--connect-sub') } @@ -862,7 +859,7 @@ program }) program - .command('local [serial..]') + .command('local [serial...]') .description('start everything locally') .option('--bind-app-pub ' , 'app pub endpoint' @@ -972,10 +969,8 @@ program , 'whether to mute master volume when devices are being used') .option('--lock-rotation' , 'whether to lock rotation when devices are being used') - .action(function() { + .action(function(serials, options) { var log = logger.createLogger('cli:local') - , args = arguments - , options = cliutil.lastArg(args) , procutil = require('./util/procutil') // Each forked process waits for signals to stop, and so we run over the @@ -1040,7 +1035,7 @@ program .concat(options.allowRemote ? ['--allow-remote'] : []) .concat(options.muteMaster ? ['--mute-master'] : []) .concat(options.lockRotation ? ['--lock-rotation'] : []) - .concat(cliutil.allUnknownArgs(args))) + .concat(serials)) // auth , procutil.fork(__filename, [ diff --git a/lib/util/cliutil.js b/lib/util/cliutil.js index 818aac01..12d90612 100644 --- a/lib/util/cliutil.js +++ b/lib/util/cliutil.js @@ -7,14 +7,6 @@ module.exports.size = function(val) { return match ? [+match[1], +match[2]] : undefined } -module.exports.allUnknownArgs = function(args) { - return [].slice.call(args, 0, -1).filter(Boolean) -} - -module.exports.lastArg = function(args) { - return args[args.length - 1] -} - module.exports.range = function(from, to) { var items = [] , i