--- a/common/corpus-common-addon/lib/commands/dl-fixtures.js Mon May 30 00:32:20 2016 +0200
+++ b/common/corpus-common-addon/lib/commands/dl-fixtures.js Mon May 30 11:27:18 2016 +0200
@@ -45,7 +45,8 @@
{ name: 'url', type: String, aliases: ['u'], description: 'Source url' },
{ name: 'dest', type: String, aliases: ['d'], description: 'File destination' },
{ name: 'page', type: Number, default: 1 , aliases: ['p'], description: 'number of page to download'},
- { name: 'format', type: String, default: 'es6' , aliases: ['f'], description: 'Format for module export, es6 or require'}
+ { name: 'format', type: String, default: 'es6' , aliases: ['f'], description: 'Format for module export, es6 or require'},
+ { name: 'extra', type: String, default: '', aliases: ['e'], description: 'additionnal data to download (comma separated list of document ids)'}
],
dl_countmap: function(commandOptions, rootKey) {
var done = Q.defer();
@@ -80,6 +81,8 @@
var nextPageUrl = commandOptions.url;
var pageIndex = 1;
+ ids.push.apply(ids,commandOptions.extra.split(','));
+
return promiseWhile(
function() { return pageIndex <= commandOptions.page && nextPageUrl; },
function() {
@@ -149,6 +152,7 @@
var ids = [];
return this.dl_documents_ids(commandOptions, rawArgs, ids).then(function() {
+ console.log(ids);
return Q.all(_.map(ids, function(id) {
var deferred = Q.defer();
request.get({url: commandOptions.url + encodeURIComponent(encodeURIComponent(id)), json: true}, function (err, res, body) {