diff --git a/bin/cli.js b/bin/cli.js index 58a8fb4..54cfbe8 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -1,10 +1,11 @@ #!/usr/bin/env node -var debug = require('debug')('ylt:cli'); -var meow = require('meow'); -var path = require('path'); +var debug = require('debug')('ylt:cli'); +var meow = require('meow'); +var path = require('path'); +var jstoxml = require('jstoxml'); -var ylt = require('../lib/index'); +var ylt = require('../lib/index'); var cli = meow({ help: [ @@ -19,6 +20,7 @@ var cli = meow({ ' --cookie Adds a cookie on the main domain.', ' --auth-user Basic HTTP authentication username.', ' --auth-pass Basic HTTP authentication password.', + ' --reporter The output format: "json" or "xml". Default is "json".', '' ].join('\n'), pkg: '../package.json' @@ -67,6 +69,12 @@ options.cookie = cli.flags.cookie || null; options.authUser = cli.flags.authUser || null; options.authPass = cli.flags.authPass || null; +// Output format +if (cli.flags.reporter && cli.flags.reporter !== 'json' && cli.flags.reporter !== 'xml') { + console.error('Incorrect parameters: reporter has to be "json" or "xml"'); + process.exit(1); +} + (function execute(url, options) { 'use strict'; @@ -76,7 +84,13 @@ options.authPass = cli.flags.authPass || null; then(function(data) { debug('Success'); - console.log(JSON.stringify(data, null, 2)); + switch(cli.flags.reporter) { + case 'xml': + console.log(jstoxml.toXML(data, {indent: ' '})); + break; + default: + console.log(JSON.stringify(data, null, 2)); + } }).fail(function(err) { diff --git a/front/src/css/rule.css b/front/src/css/rule.css index 508d3b0..ccc72a5 100644 --- a/front/src/css/rule.css +++ b/front/src/css/rule.css @@ -29,9 +29,16 @@ border-radius: 0.5em; margin: 0 auto 0.5em; } +.rule h3 { + margin-bottom: 0em; +} +.rule .okThreshold { + font-style: italic; + font-size: 0.9em; +} .rule .message { width: 80%; - margin: 0 auto; + margin: 1.5em auto; } .rule .message p { margin: 0.5em; diff --git a/front/src/less/rule.less b/front/src/less/rule.less index 9cf165e..7a2571f 100644 --- a/front/src/less/rule.less +++ b/front/src/less/rule.less @@ -32,9 +32,18 @@ margin: 0 auto 0.5em; } +.rule h3 { + margin-bottom: 0em; +} + +.rule .okThreshold { + font-style: italic; + font-size: 0.9em; +} + .rule .message { width: 80%; - margin: 0 auto; + margin: 1.5em auto; p { margin: 0.5em; } diff --git a/front/src/views/index.html b/front/src/views/index.html index f83be65..e6e55e1 100644 --- a/front/src/views/index.html +++ b/front/src/views/index.html @@ -2,7 +2,7 @@
Free and open source!