Skip to content

Commit

Permalink
clean up unused switch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Jan 25, 2022
1 parent 9002d39 commit 4f6ba85
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions packages/astro/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,11 @@ function resolveCommand(flags: Arguments): CLICommand {
return 'help';
}
const cmd = flags._[2];
switch (cmd) {
case 'dev':
return 'dev';
case 'build':
return 'build';
case 'preview':
return 'preview';
case 'check':
return 'check';
default:
return 'help';
const supportedCommands = new Set(['dev', 'build', 'preview', 'check']);
if (supportedCommands.has(cmd)) {
return cmd as 'dev' | 'build' | 'preview' | 'check';
}
return 'help';
}

/** The primary CLI action */
Expand Down Expand Up @@ -117,6 +110,7 @@ export async function cli(args: string[]) {

return;
}

case 'build': {
try {
await build(config, { logging });
Expand All @@ -126,10 +120,12 @@ export async function cli(args: string[]) {
}
return;
}

case 'check': {
const ret = await check(config);
return process.exit(ret);
}

case 'preview': {
try {
await preview(config, { logging }); // this will keep running
Expand All @@ -138,6 +134,7 @@ export async function cli(args: string[]) {
}
return;
}

default: {
throw new Error(`Error running ${cmd}`);
}
Expand Down

0 comments on commit 4f6ba85

Please sign in to comment.