Skip to content

Commit fc22f91

Browse files
committed
tweaks
1 parent 71e729e commit fc22f91

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

scripts/rescript_format.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ in the stdout (in rescript syntax)`,
3333
"Formatting the whole project ",
3434
],
3535
];
36-
36+
var formattedExtensions = [".res", ".resi", ".ml", ".mli", ".re", ".rei"];
3737
async function readStdin() {
3838
var stream = process.stdin;
3939
const chunks = [];
@@ -92,14 +92,7 @@ function main(argv, bsb_exe, bsc_exe) {
9292
}
9393
}
9494
} else if (use_stdin) {
95-
if (
96-
use_stdin.endsWith(".res") ||
97-
use_stdin.endsWith(".resi") ||
98-
use_stdin.endsWith(".ml") ||
99-
use_stdin.endsWith(".mli") ||
100-
use_stdin.endsWith(".re") ||
101-
use_stdin.endsWith(".rei")
102-
) {
95+
if (formattedExtensions.some((x) => use_stdin.endsWith(x))) {
10396
var crypto = require("crypto");
10497
var os = require("os");
10598
var filename = path.join(
@@ -122,6 +115,10 @@ function main(argv, bsb_exe, bsc_exe) {
122115
}
123116
);
124117
})();
118+
} else {
119+
console.error(`Unsupported exetnsion ${use_stdin}`);
120+
console.error(`Supported extensions: ${formattedExtensions} `);
121+
process.exit(2);
125122
}
126123
} else {
127124
if (files.length === 0) {

0 commit comments

Comments
 (0)