diff --git a/HELP.md b/HELP.md index 2eafbb3e..92b0d735 100644 --- a/HELP.md +++ b/HELP.md @@ -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. diff --git a/bin/cloudcmd.js b/bin/cloudcmd.js index a3b3b522..5e0450ba 100755 --- a/bin/cloudcmd.js +++ b/bin/cloudcmd.js @@ -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); } diff --git a/json/bin.json b/json/bin.json index bec0ad85..d707ca98 100644 --- a/json/bin.json +++ b/json/bin.json @@ -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" }