* Start work on new oputil format: oputil <command> <action> <args> <target>

* Add auto tagging for oputil scan
This commit is contained in:
Bryan Ashby 2017-02-13 22:51:20 -07:00
parent aa40d998b2
commit 9b0f956934
2 changed files with 70 additions and 25 deletions

View file

@ -584,10 +584,14 @@ function scanFile(filePath, options, iterator, cb) {
);
}
function scanFileAreaForChanges(areaInfo, iterator, cb) {
if(!cb && _.isFunction(iterator)) {
cb = iterator;
iterator = null;
function scanFileAreaForChanges(areaInfo, options, iterator, cb) {
if(3 === arguments.length && _.isFunction(iterator)) {
cb = iterator;
iterator = null;
} else if(2 === arguments.length && _.isFunction(options)) {
cb = options;
iterator = null;
options = {};
}
const storageLocations = getAreaStorageLocations(areaInfo);
@ -632,6 +636,11 @@ function scanFileAreaForChanges(areaInfo, iterator, cb) {
if(dupeEntries.length > 0) {
// :TODO: Handle duplidates -- what to do here???
} else {
if(Array.isArray(options.tags)) {
options.tags.forEach(tag => {
fileEntry.hashTags.add(tag);
});
}
addNewFileEntry(fileEntry, fullPath, err => {
// pass along error; we failed to insert a record in our DB or something else bad
return nextFile(err);