Skip to content

Commit 4b7c7c8

Browse files
committed
rescript.js: use a switch statement
1 parent 1772295 commit 4b7c7c8

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

cli/rescript.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,25 @@ try {
1414
const subcommand = args[firstPositionalArgIndex];
1515
const subcommandWithArgs = args.slice(firstPositionalArgIndex);
1616

17-
if (
18-
subcommand === "build" ||
19-
subcommand === "watch" ||
20-
subcommand === "clean" ||
21-
subcommand === "compiler-args" ||
22-
subcommand === "format"
23-
) {
24-
child_process.execFileSync(
25-
rescript_exe,
26-
[...subcommandWithArgs, "--bsc-path", bsc_exe],
27-
{
17+
switch (subcommand) {
18+
case "build":
19+
case "watch":
20+
case "clean":
21+
case "compiler-args":
22+
case "format":
23+
child_process.execFileSync(
24+
rescript_exe,
25+
[...subcommandWithArgs, "--bsc-path", bsc_exe],
26+
{
27+
stdio: "inherit",
28+
},
29+
);
30+
break;
31+
default:
32+
child_process.execFileSync(rescript_exe, [...args], {
2833
stdio: "inherit",
29-
},
30-
);
31-
} else {
32-
child_process.execFileSync(rescript_exe, [...args], {
33-
stdio: "inherit",
34-
});
34+
});
35+
break;
3536
}
3637
} else {
3738
// no subcommand means build subcommand

0 commit comments

Comments
 (0)