зеркало из https://github.com/twbs/bootlint.git
Merge pull request #213 from twbs/saner-stdin
Use more common way to determine if stdin should be read
This commit is contained in:
Коммит
bb705ba43d
12
src/cli.js
12
src/cli.js
|
@ -17,8 +17,8 @@ program
|
|||
return val.split(',');
|
||||
})
|
||||
.parse(process.argv);
|
||||
var disabledIds = program.disable === undefined ? [] : program.disable;
|
||||
|
||||
var disabledIds = program.disable === undefined ? [] : program.disable;
|
||||
var totalErrCount = 0;
|
||||
var totalFileCount = 0;
|
||||
var lintedFiles = [];
|
||||
|
@ -44,7 +44,7 @@ function buildReporter(origin) {
|
|||
|
||||
function handleStdin() {
|
||||
return new Deferred(function (resolve) {
|
||||
if (typeof process.stdin.isTTY !== 'boolean' || process.stdin.isTTY) {
|
||||
if (process.stdin.isTTY) {
|
||||
return resolve();
|
||||
}
|
||||
|
||||
|
@ -79,11 +79,15 @@ function handlePath(pattern) {
|
|||
});
|
||||
}
|
||||
|
||||
if (!program.args.length) {
|
||||
program.args.push('-');
|
||||
}
|
||||
|
||||
program.args.forEach(function (pattern) {
|
||||
lintedFiles.push(handlePath(pattern));
|
||||
lintedFiles.push(pattern === '-' ? handleStdin() : handlePath(pattern));
|
||||
});
|
||||
|
||||
Deferred.join(handleStdin(), Deferred.all(lintedFiles)).then(function () {
|
||||
Deferred.all(lintedFiles).then(function () {
|
||||
console.log("");
|
||||
|
||||
if (totalErrCount > 0) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче