Skip to content

Commit 5cb430e

Browse files
committed
clean: Use switch statements instead of ifs for string literal union types
1 parent 0468448 commit 5cb430e

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export async function getInput(inputType: InputType, inputArgs: string[], ignore
7373
case 'stdin':
7474
return utils.readStdin();
7575

76-
default:
76+
case 'command':
7777
return runGitDiff(inputArgs, ignore);
7878
}
7979
}

src/main.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ export async function main(): Promise<void> {
2727

2828
if (configuration.outputDestinationFile) utils.writeFile(configuration.outputDestinationFile, output);
2929

30-
if (configuration.outputDestinationType === 'preview') {
31-
cli.preview(output, configuration.formatType);
32-
} else if (configuration.outputDestinationType === 'stdout') {
33-
log.print(output);
30+
switch (configuration.outputDestinationType) {
31+
case 'preview':
32+
return cli.preview(output, configuration.formatType);
33+
34+
case 'stdout':
35+
return log.print(output);
3436
}
3537
} catch (error) {
3638
if (process.exitCode === undefined || process.exitCode === 0) {

template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
});
2626
</script>
2727
</head>
28-
<body style="text-align: center; font-family: 'Source Sans Pro',sans-serif;">
28+
<body style="text-align: center; font-family: 'Source Sans Pro', sans-serif;">
2929
<h1>Diff to HTML by <a href="https://github.com/rtfpessoa">rtfpessoa</a></h1>
3030

3131
<div id="diff">

0 commit comments

Comments
 (0)