Skip to content

Commit 089bdf5

Browse files
committed
display files for ml formatting
1 parent 236dd45 commit 089bdf5

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

scripts/rescript_format.js

+12-17
Original file line numberDiff line numberDiff line change
@@ -145,29 +145,24 @@ function main(argv, bsb_exe, bsc_exe) {
145145

146146
for (let i = 0; i < files.length; ++i) {
147147
let file = files[i];
148-
if (!isSupportedFile(file)) {
149-
if (isSupportedConvert(file)) {
150-
console.error(
151-
`You need convert subcommand to handle such file extensions`
152-
);
153-
} else {
154-
console.error(`Don't know what do with ${file}`);
155-
}
156-
console.error(`Supported extensions: ${formattedFileExtensions}`)
148+
if (!isSupportedStd(file)) {
149+
console.error(`Don't know what do with ${file}`);
150+
console.error(`Supported extensions: ${formattedFileExtensions}`);
157151
process.exit(2);
158152
}
159153
}
160154
files.forEach((file) => {
161-
child_process.execFile(
162-
bsc_exe,
163-
["-o", file, "-format", file],
164-
(error, stdout, stderr) => {
165-
if (error === null) {
166-
} else {
167-
console.log(stderr);
155+
var write = isSupportedFile(file);
156+
var flags = write ? ["-o", file, "-format", file] : ["-format", file];
157+
child_process.execFile(bsc_exe, flags, (error, stdout, stderr) => {
158+
if (error === null) {
159+
if (!write) {
160+
console.log(stdout);
168161
}
162+
} else {
163+
console.log(stderr);
169164
}
170-
);
165+
});
171166
});
172167
}
173168
} catch (e) {

0 commit comments

Comments
 (0)