feature(bin) add --no-online, --no-auth, --no-server

This commit is contained in:
coderaiser 2015-03-25 04:40:00 -04:00
parent 249e6ccb0d
commit 54ee683838
3 changed files with 18 additions and 23 deletions

View file

@ -62,13 +62,13 @@ Cloud Commander supports command line parameters:
| `-v, --version` | output version information and exit
| `-s, --save` | save options
| `-on, --online` | load scripts from remote servers
| `-off, --offline` | load scripts from local server
| `-a, --auth` | enable authorization
| `-na, --noauth` | disable authorization
| `-p, --port` | set port number
| `-u, --username` | set username
| `-ps, --password` | set password
| `-ns, --noserver` | do not start server
| `--noauth` | disable authorization
| `--no-server` | do not start server
| `--no-online` | load scripts from remote servers
If no parameters given Cloud Commander reads information from `~/.cloudcmd.json` and use
port from it (`8000` default). if port variables `PORT` or `VCAP_APP_PORT` isn't exist.

View file

@ -5,6 +5,7 @@
var config,
Info = require('../package'),
Config = require('../json/config.json'),
DIR = __dirname + '/../',
DIR_LIB = DIR + 'lib/',
@ -26,22 +27,23 @@
],
boolean: [
'auth',
'noauth',
'noserver',
'server',
'repl',
'save'],
default: {
'auth' : Config.auth,
'online': Config.online,
'server': true
},
alias: {
v: 'version',
h: 'help',
p: 'port',
on: 'online',
off: 'offline',
u: 'username',
ps: 'password',
s: 'save',
a: 'auth',
na: 'noauth',
ns: 'noserver'
a: 'auth'
}
});
@ -59,15 +61,8 @@
username(args.username);
port(args.port);
if (args.auth)
config('auth', true);
else if (args['no-auth'])
config('auth', false);
if (args.online)
config('online', true);
else if (args.offline)
config('offline', false);
config('auth', args.auth);
config('online', args.online);
if (args.save)
config.save(start);
@ -82,7 +77,7 @@
function start(config) {
var SERVER = '../lib/server';
if (!args.noserver)
if (args.server)
require(SERVER)(config);
}

View file

@ -2,12 +2,12 @@
"-h, --help " : "display this help and exit",
"-v, --version " : "output version information and exit",
"-s, --save " : "save options",
"-on, --online " : "load scripts from remote servers",
"-off, --offline" : "load scripts from local server",
"-o, --online " : "load scripts from remote servers",
"-a, --auth " : "enable authorization",
"-na, --noauth " : "disable authorization",
"-p, --port " : "set port number",
"-u, --username " : "set username",
"-ps, --password" : "set password",
"-ns, --noserver" : "do not start server"
"--no-auth " : "disable authorization",
"--no-server" : "do not start server",
"--no-online" : "load scripts from local server"
}