Add multiple files support

This commit is contained in:
Pelle Jacobs 2017-11-02 14:05:58 +01:00
parent 6ef022c8f8
commit 3b60ed473a
1 changed files with 7 additions and 2 deletions

View File

@ -22,18 +22,23 @@ var help = function () {
console.log(' $ ttl <path-to-file>');
console.log(' $ curl http://data.linkeddatafragments.org/dbpedia -H "accept: text/turtle" | ttl');
console.log(' $ ttl http://triples.demo.thedatatank.com/demo.ttl');
console.log(' $ ttl <path-to-file> <path-to-second-file>');
};
var args = process.argv.slice(2);
if (args.length > 1 || (args.length > 0 && (args[0] === "-h" || args[0] === "--help")))
if (args.length > 0 && (args[0] === "-h" || args[0] === "--help"))
return help();
if (args.length === 0) {
validate(process.stdin, showValidation);
} else if (args.length > 0) {
args.forEach(validateArgument);
}
function validateArgument(arg) {
// Create a stream from the file, whether it is a local file or a http stream
var parsedUrl = url.parse(args[0]);
var parsedUrl = url.parse(arg);
switch (parsedUrl.protocol) {
case 'https:':
http = require('https');