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