Skip to content

Commit bcbbf5c

Browse files
committed
fix: exception handling
1 parent 9fbd78a commit bcbbf5c

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

src/index.ts

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,31 @@ import {ServeCommand} from './commands/serve';
44
import {UploadCommand} from './commands/upload';
55
import {createCommand} from 'commander';
66

7-
async function main() {
8-
const program = createCommand();
7+
const program = createCommand();
98

10-
program
11-
.command('upload [dir]')
12-
.description('Uploads a directory to cloud storage')
13-
.option('-p, --google-cloud-project <project>', 'project', '')
14-
.option('-s, --site <site>', 'site', '')
15-
.option('-r, --ref <ref>', 'ref', '')
16-
.option('-b, --branch <branch>', 'branch', '')
17-
.option('-f, --force', 'force', false)
18-
.option('-t, --ttl <ttl>', 'ttl', undefined)
19-
.option('-o, --output-file <path>', 'output file', '')
20-
.action(async (path, options) => {
21-
const cmd = new UploadCommand(options);
22-
await cmd.run(path);
23-
});
9+
program
10+
.command('upload [dir]')
11+
.description('Uploads a directory to cloud storage')
12+
.option('-p, --google-cloud-project <project>', 'project', '')
13+
.option('-s, --site <site>', 'site', '')
14+
.option('-r, --ref <ref>', 'ref', '')
15+
.option('-b, --branch <branch>', 'branch', '')
16+
.option('-f, --force', 'force', false)
17+
.option('-t, --ttl <ttl>', 'ttl', undefined)
18+
.option('-o, --output-file <path>', 'output file', '')
19+
.action(async (path, options) => {
20+
const cmd = new UploadCommand(options);
21+
await cmd.run(path);
22+
});
2423

25-
program
26-
.command('serve')
27-
.description('Runs the server')
28-
.option('-s, --site <site>', 'site', '')
29-
.option('-r, --ref <ref>', 'ref', '')
30-
.action(options => {
31-
const cmd = new ServeCommand(options);
32-
cmd.run();
33-
});
24+
program
25+
.command('serve')
26+
.description('Runs the server')
27+
.option('-s, --site <site>', 'site', '')
28+
.option('-r, --ref <ref>', 'ref', '')
29+
.action(options => {
30+
const cmd = new ServeCommand(options);
31+
cmd.run();
32+
});
3433

35-
await program.parseAsync(process.argv);
36-
}
37-
38-
main();
34+
program.parse(process.argv);

0 commit comments

Comments
 (0)