Skip to content

Commit

Permalink
Support 'lang' option.
Browse files Browse the repository at this point in the history
  • Loading branch information
ISKU committed Apr 4, 2018
1 parent 2f7bf9c commit b0ca87b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,18 @@ function downloadSource() {
console.log('* Failed to download source number #' + sourceNumber + ', problem number #' + problemNumber + '\n');
next(index - 1);
} else if (option.private(info, userInfo)) {
saveSource(sourceTree, sourceName, info, function() {
gitAll(info, function() {
next(index - 1);
if (option.lang(language, userInfo)) {
saveSource(sourceTree, sourceName, info, function() {
gitAll(info, function() {
next(index - 1);
});
});
});
} else {
console.log('* Problem #' + problemNumber + ' is not a ' + userInfo.lang + ' language.');
next(index - 1);
}
} else {
console.log('* Problem #' + info.problemNumber + ' is private.');
console.log('* Problem #' + problemNumber + ' is private.');
next(index - 1);
}
});
Expand Down
8 changes: 8 additions & 0 deletions option.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ exports.sourceName = function(problemNumber, language, userInfo) {
return problemNumber + getExt(language);
}

exports.lang = function(language, userInfo) {
if (userInfo.hasOwnProperty('lang'))
if (userInfo.lang.toUpperCase() == language.toUpperCase())
return true;

return false;
}

function replaceNumber(value, problemNumber) {
return value.replace(/\[NO\]/gi, problemNumber);
}
Expand Down

0 comments on commit b0ca87b

Please sign in to comment.