add another option

This commit is contained in:
AJ ONeal 2015-09-25 08:07:08 +00:00
parent 3de6e4843d
commit 7d899a7f04
1 changed files with 10 additions and 4 deletions

View File

@ -14,7 +14,7 @@ cli.parse({
, insecure: [ false, '(deprecated) allow insecure non-https connections', 'boolean' ] , insecure: [ false, '(deprecated) allow insecure non-https connections', 'boolean' ]
, cacert: [ false, '(not implemented) specify a CA for "self-signed" https certificates', 'string' ] , cacert: [ false, '(not implemented) specify a CA for "self-signed" https certificates', 'string' ]
, answer: [ 'a', 'The answer', 'string' ] , answer: [ 'a', 'The answer', 'string' ]
, token: [ false, 'Token', 'string' ] , token: [ false, 'Token (TODO or filepath to token)', 'string' ]
}); });
cli.main(function (args, options) { cli.main(function (args, options) {
@ -23,8 +23,9 @@ cli.main(function (args, options) {
options.answer = options.answer || args[1] options.answer = options.answer || args[1]
if (options.insecure) { if (options.insecure) {
console.error('--insecure is not supported. You must use secure connections.'); //console.error('--insecure is not supported. You must use secure connections.');
return; //return;
options.cacert = false;
} }
if (!options.hostname) { if (!options.hostname) {
@ -42,6 +43,7 @@ cli.main(function (args, options) {
updater: options.service updater: options.service
, port: options.port , port: options.port
, cacert: options.cacert , cacert: options.cacert
, token: options.token
, ddns: [ , ddns: [
{ "name": options.hostname { "name": options.hostname
, "value": options.answer , "value": options.answer
@ -52,7 +54,11 @@ cli.main(function (args, options) {
] ]
}).then(function (data) { }).then(function (data) {
if ('string') { if ('string') {
data = JSON.parse(data); try {
data = JSON.parse(data);
} catch(e) {
console.error(data);
}
} }
console.log(JSON.stringify(data, null, ' ')); console.log(JSON.stringify(data, null, ' '));