mirror of
https://github.com/openstf/stf
synced 2025-10-03 17:59:28 +02:00
Unify CLI option code format.
This commit is contained in:
parent
697e552ef0
commit
52e1b8094f
1 changed files with 60 additions and 28 deletions
88
lib/cli.js
88
lib/cli.js
|
@ -9,8 +9,12 @@ program
|
|||
program
|
||||
.command('provider [serial..]')
|
||||
.description('start provider')
|
||||
.option('-s, --connect-sub <endpoint>', 'sub endpoint', cliutil.list)
|
||||
.option('-p, --connect-push <endpoint>', 'push endpoint', cliutil.list)
|
||||
.option('-s, --connect-sub <endpoint>'
|
||||
, 'sub endpoint'
|
||||
, cliutil.list)
|
||||
.option('-p, --connect-push <endpoint>'
|
||||
, 'push endpoint'
|
||||
, cliutil.list)
|
||||
.action(function() {
|
||||
var serials = cliutil.allUnknownArgs(arguments)
|
||||
, options = cliutil.lastArg(arguments)
|
||||
|
@ -44,8 +48,12 @@ program
|
|||
program
|
||||
.command('device <serial>')
|
||||
.description('start device worker')
|
||||
.option('-s, --connect-sub <endpoint>', 'sub endpoint', cliutil.list)
|
||||
.option('-p, --connect-push <endpoint>', 'push endpoint', cliutil.list)
|
||||
.option('-s, --connect-sub <endpoint>'
|
||||
, 'sub endpoint'
|
||||
, cliutil.list)
|
||||
.option('-p, --connect-push <endpoint>'
|
||||
, 'push endpoint'
|
||||
, cliutil.list)
|
||||
.action(function(serial, options) {
|
||||
if (!options.connectSub) {
|
||||
this.missingArgument('--connect-sub')
|
||||
|
@ -66,10 +74,12 @@ program
|
|||
program
|
||||
.command('coordinator <name>')
|
||||
.description('start coordinator')
|
||||
.option('-a, --connect-app-dealer <endpoint>', 'app dealer endpoint',
|
||||
cliutil.list)
|
||||
.option('-d, --connect-dev-dealer <endpoint>', 'device dealer endpoint',
|
||||
cliutil.list)
|
||||
.option('-a, --connect-app-dealer <endpoint>'
|
||||
, 'app dealer endpoint'
|
||||
, cliutil.list)
|
||||
.option('-d, --connect-dev-dealer <endpoint>'
|
||||
, 'device dealer endpoint'
|
||||
, cliutil.list)
|
||||
.action(function(name, options) {
|
||||
if (!options.connectAppDealer) {
|
||||
this.missingArgument('--connect-app-dealer')
|
||||
|
@ -90,12 +100,18 @@ program
|
|||
program
|
||||
.command('triproxy <name>')
|
||||
.description('start triproxy')
|
||||
.option('-u, --bind-pub <endpoint>', 'pub endpoint',
|
||||
String, 'tcp://*:7111')
|
||||
.option('-d, --bind-dealer <endpoint>', 'dealer endpoint',
|
||||
String, 'tcp://*:7112')
|
||||
.option('-p, --bind-pull <endpoint>', 'pull endpoint',
|
||||
String, 'tcp://*:7113')
|
||||
.option('-u, --bind-pub <endpoint>'
|
||||
, 'pub endpoint'
|
||||
, String
|
||||
, 'tcp://*:7111')
|
||||
.option('-d, --bind-dealer <endpoint>'
|
||||
, 'dealer endpoint'
|
||||
, String
|
||||
, 'tcp://*:7112')
|
||||
.option('-p, --bind-pull <endpoint>'
|
||||
, 'pull endpoint'
|
||||
, String
|
||||
, 'tcp://*:7113')
|
||||
.action(function(name, options) {
|
||||
require('./roles/triproxy')({
|
||||
name: name
|
||||
|
@ -171,8 +187,12 @@ program
|
|||
program
|
||||
.command('console')
|
||||
.description('start console')
|
||||
.option('-s, --connect-sub <endpoint>', 'sub endpoint', cliutil.list)
|
||||
.option('-p, --connect-push <endpoint>', 'push endpoint', cliutil.list)
|
||||
.option('-s, --connect-sub <endpoint>'
|
||||
, 'sub endpoint'
|
||||
, cliutil.list)
|
||||
.option('-p, --connect-push <endpoint>'
|
||||
, 'push endpoint'
|
||||
, cliutil.list)
|
||||
.action(function(options) {
|
||||
if (!options.connectSub) {
|
||||
this.missingArgument('--connect-sub')
|
||||
|
@ -192,18 +212,30 @@ program
|
|||
program
|
||||
.command('local [serial..]')
|
||||
.description('start everything locally')
|
||||
.option('--bind-app-pub <endpoint>', 'app pub endpoint',
|
||||
String, 'tcp://127.0.0.1:7111')
|
||||
.option('--bind-app-dealer <endpoint>', 'app dealer endpoint',
|
||||
String, 'tcp://127.0.0.1:7112')
|
||||
.option('--bind-app-pull <endpoint>', 'app pull endpoint',
|
||||
String, 'tcp://127.0.0.1:7113')
|
||||
.option('--bind-dev-pub <endpoint>', 'device pub endpoint',
|
||||
String, 'tcp://127.0.0.1:7114')
|
||||
.option('--bind-dev-dealer <endpoint>', 'device dealer endpoint',
|
||||
String, 'tcp://127.0.0.1:7115')
|
||||
.option('--bind-dev-pull <endpoint>', 'device pull endpoint',
|
||||
String, 'tcp://127.0.0.1:7116')
|
||||
.option('--bind-app-pub <endpoint>'
|
||||
, 'app pub endpoint'
|
||||
, String
|
||||
, 'tcp://127.0.0.1:7111')
|
||||
.option('--bind-app-dealer <endpoint>'
|
||||
, 'app dealer endpoint'
|
||||
, String
|
||||
, 'tcp://127.0.0.1:7112')
|
||||
.option('--bind-app-pull <endpoint>'
|
||||
, 'app pull endpoint'
|
||||
, String
|
||||
, 'tcp://127.0.0.1:7113')
|
||||
.option('--bind-dev-pub <endpoint>'
|
||||
, 'device pub endpoint'
|
||||
, String
|
||||
, 'tcp://127.0.0.1:7114')
|
||||
.option('--bind-dev-dealer <endpoint>'
|
||||
, 'device dealer endpoint'
|
||||
, String
|
||||
, 'tcp://127.0.0.1:7115')
|
||||
.option('--bind-dev-pull <endpoint>'
|
||||
, 'device pull endpoint'
|
||||
, String
|
||||
, 'tcp://127.0.0.1:7116')
|
||||
.action(function() {
|
||||
var options = cliutil.lastArg(arguments)
|
||||
, fork = require('child_process').fork
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue