This commit is contained in:
jean-emmanuel 2015-10-30 12:10:48 +01:00
parent f74d259262
commit daac2b4d01
2 changed files with 13 additions and 7 deletions

View file

@ -30,11 +30,12 @@ $ npm install
**Command line switches**
```
Options:
--help display help
-h, --host synchronized hosts (ip:port pairs)
-h, --help display help
-s, --sync synchronized hosts (ip:port pairs)
-c, --compile recompile stylesheets (increases startup time)
-l, --load session file to load
-p, --port osc input port (for synchronization)
-n, --nogui disable default gui and makes the app availabe through http on specified port
Exemples :
@ -42,6 +43,11 @@ $ electron /path/to/app/ -h 127.0.0.1:5555 127.0.0.1:6666 -p 7777
This will create an app listening on port 7777 for synchronization messages, and sending its widgets state changes to ports 5555 and 6666.
$ electron /path/to/app/ -n 8080 -l path/to/session.js
This will create a headless app available through http on port 8080. Multiple clients can use the app (with chrome only) simultaneously, their widgets will be synchronized.
```

View file

@ -12,9 +12,9 @@ var app = require('app')
, window = null
, argv = require('yargs')
.help('help').usage(`\nUsage:\n $0 [options]`)
.help('help').usage(`\nUsage:\n $0 [options]`).alias('h', 'help')
.options({
'h':{alias:'host',type:'array',describe:'synchronized hosts (ip:port pairs)'},
's':{alias:'sync',type:'array',describe:'synchronized hosts (ip:port pairs)'},
'c':{alias:'compile',type:'boolean',describe:'recompile stylesheets (increases startup time)'},
'l':{alias:'load',type:'string',describe:'session file to load'},
'p':{alias:'port',describe:'osc input port (for synchronization)'},
@ -23,7 +23,7 @@ var app = require('app')
})
.check(function(a,x){if(a.port==undefined || !isNaN(a.p)&&a.p>1023&&parseInt(a.p)===a.p){return true}else{throw 'Error: Port must be an integer >= 1024'}})
.check(function(a,x){if(a.n==undefined || !isNaN(a.n)&&a.n>1023&&parseInt(a.n)===a.n){return true}else{throw 'Error: Port must be an integer >= 1024'}})
.check(function(a,x){if(a.host==undefined || a.h.join(' ').match('^([^:\s]*:[0-9]{4,5}[\s]*)*$')!=null){return true}else{throw 'Error: Hosts must ne ip:port pairs & port must be >= 1024'}})
.check(function(a,x){if(a.sync==undefined || a.s.join(' ').match('^([^:\s]*:[0-9]{4,5}[\s]*)*$')!=null){return true}else{throw 'Error: Sync hosts must be ip:port pairs & port must be >= 1024'}})
.strict()
.argv
@ -32,8 +32,8 @@ var app = require('app')
sessionPath: process.cwd(),
recentSessions: [],
appName: argv.n || 'Controller',
syncTargets: argv.h || false,
appName: 'OSC Controller',
syncTargets: argv.s || false,
oscInPort: argv.p || false,
compileScss: argv.c || false,
sessionFile: argv.l || false,