Skip to content

Commit

Permalink
indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mansurt committed Apr 26, 2017
1 parent 31ea6a6 commit d447cca
Showing 1 changed file with 50 additions and 50 deletions.
100 changes: 50 additions & 50 deletions lib/list.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
var path = require('path');
var when = require('when');
var u = {= {
var u = {
run : require('../util/run'),
switches: require('../util/switches')
};
Expand All @@ -18,7 +18,7 @@ var u = {= {
module.exports = function (archive, options, filesRequiredFields) {
return when.promise(function (resolve, reject, progress) {

var spec = {};
var spec = {};
/* jshint maxlen: 130 */
var regex = /(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) ([\.DA]+)\s+(\d+)\s*(?:\d+)\s+(\S+?\.\S+)/;
/* jshint maxlen: 80 */
Expand Down Expand Up @@ -54,56 +54,56 @@ module.exports = function (archive, options, filesRequiredFields) {
}

data.split('\n').forEach(function (line) {
// Populate the tech specs of the archive that are passed to the
// resolve handler.
if (line.substr(0, 7) === 'Path = ') {
if (isRequiredProperty(filesRequiredFields, 'Path')) {
spec.path = line.substr(7, line.length);
}
} else if (line.substr(0, 7) === 'Type = ') {
if (isRequiredProperty(filesRequiredFields, 'Type')) {
spec.type = line.substr(7, line.length);
}
} else if (line.substr(0, 9) === 'Method = ') {
if (isRequiredProperty(filesRequiredFields, 'Method')) {
spec.method = line.substr(9, line.length);
}
} else if (line.substr(0, 16) === 'Physical Size = ') {
if (isRequiredProperty(filesRequiredFields, 'Physical Size')) {
spec.physicalSize = parseInt(line.substr(16, line.length), 10);
}
} else if (line.substr(0, 15) === 'Headers Size = ') {
if (isRequiredProperty(filesRequiredFields, 'Headers Size')) {
spec.headersSize = parseInt(line.substr(15, line.length), 10);
}
} else if (line.substr(0, 12) === 'Encrypted = ') {
if (isRequiredProperty(filesRequiredFields, 'Encrypted')) {
pec.encrypted = line.substr(12, line.length);
}
} else {
// Parse the stdout to find entries
var res = regex.exec(line);
if (res) {
if (parseInt(res[1])) {
var return_date = new Date(res[1]);
} else {
var return_date = null;
// Populate the tech specs of the archive that are passed to the
// resolve handler.
if (line.substr(0, 7) === 'Path = ') {
if (isRequiredProperty(filesRequiredFields, 'Path')) {
spec.path = line.substr(7, line.length);
}
} else if (line.substr(0, 7) === 'Type = ') {
if (isRequiredProperty(filesRequiredFields, 'Type')) {
spec.type = line.substr(7, line.length);
}
} else if (line.substr(0, 9) === 'Method = ') {
if (isRequiredProperty(filesRequiredFields, 'Method')) {
spec.method = line.substr(9, line.length);
}
} else if (line.substr(0, 16) === 'Physical Size = ') {
if (isRequiredProperty(filesRequiredFields, 'Physical Size')) {
spec.physicalSize = parseInt(line.substr(16, line.length), 10);
}
} else if (line.substr(0, 15) === 'Headers Size = ') {
if (isRequiredProperty(filesRequiredFields, 'Headers Size')) {
spec.headersSize = parseInt(line.substr(15, line.length), 10);
}
} else if (line.substr(0, 12) === 'Encrypted = ') {
if (isRequiredProperty(filesRequiredFields, 'Encrypted')) {
pec.encrypted = line.substr(12, line.length);
}
} else {
// Parse the stdout to find entries
var res = regex.exec(line);
if (res) {
if (parseInt(res[1])) {
var return_date = new Date(res[1]);
} else {
var return_date = null;
}

var e = {
date: return_date,
attr: res[2],
size: parseInt(res[3], 10),
name: res[5].replace(path.sep, '/')
};

entries.push(e);
}

// Line may be incomplete, Save it to the buffer.
else buffer = line;

var e = {
date: return_date,
attr: res[2],
size: parseInt(res[3], 10),
name: res[5].replace(path.sep, '/')
};

entries.push(e);
}

// Line may be incomplete, Save it to the buffer.
else buffer = line;

}
}
});
return progress(entries);
})
Expand Down

0 comments on commit d447cca

Please sign in to comment.