Skip to content

Commit ee7b71a

Browse files
committed
Make executable process file regardless of extension if file path (not directory path) is passed in as arg
1 parent f55b21d commit ee7b71a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

bin/htmlhint

100644100755
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,16 @@ function getAllFiles(arrTargets){
7979
var arrAllFiles = [];
8080
if(arrTargets.length > 0){
8181
for(var i=0,l=arrTargets.length;i<l;i++){
82-
getFiles(arrTargets[i], arrAllFiles);
82+
var filepath = path.resolve(process.cwd(), arrTargets[i]);
83+
if(fs.existsSync(filepath) !== false){
84+
if(fs.statSync(filepath).isFile) {
85+
arrAllFiles.push(filepath);
86+
} else {
87+
getFiles(arrTargets[i], arrAllFiles);
88+
}
89+
} else {
90+
console.log('File %s does not exist'.red, arrTargets[i]);
91+
}
8392
}
8493
}
8594
else{
@@ -144,4 +153,4 @@ function quit(code){
144153
} else {
145154
process.exit(code || 0);
146155
}
147-
}
156+
}

0 commit comments

Comments
 (0)