Skip to content

Commit

Permalink
fix: exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydw committed Sep 21, 2021
1 parent 9fbd78a commit bcbbf5c
Showing 1 changed file with 25 additions and 29 deletions.
54 changes: 25 additions & 29 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,31 @@ import {ServeCommand} from './commands/serve';
import {UploadCommand} from './commands/upload';
import {createCommand} from 'commander';

async function main() {
const program = createCommand();
const program = createCommand();

program
.command('upload [dir]')
.description('Uploads a directory to cloud storage')
.option('-p, --google-cloud-project <project>', 'project', '')
.option('-s, --site <site>', 'site', '')
.option('-r, --ref <ref>', 'ref', '')
.option('-b, --branch <branch>', 'branch', '')
.option('-f, --force', 'force', false)
.option('-t, --ttl <ttl>', 'ttl', undefined)
.option('-o, --output-file <path>', 'output file', '')
.action(async (path, options) => {
const cmd = new UploadCommand(options);
await cmd.run(path);
});
program
.command('upload [dir]')
.description('Uploads a directory to cloud storage')
.option('-p, --google-cloud-project <project>', 'project', '')
.option('-s, --site <site>', 'site', '')
.option('-r, --ref <ref>', 'ref', '')
.option('-b, --branch <branch>', 'branch', '')
.option('-f, --force', 'force', false)
.option('-t, --ttl <ttl>', 'ttl', undefined)
.option('-o, --output-file <path>', 'output file', '')
.action(async (path, options) => {
const cmd = new UploadCommand(options);
await cmd.run(path);
});

program
.command('serve')
.description('Runs the server')
.option('-s, --site <site>', 'site', '')
.option('-r, --ref <ref>', 'ref', '')
.action(options => {
const cmd = new ServeCommand(options);
cmd.run();
});
program
.command('serve')
.description('Runs the server')
.option('-s, --site <site>', 'site', '')
.option('-r, --ref <ref>', 'ref', '')
.action(options => {
const cmd = new ServeCommand(options);
cmd.run();
});

await program.parseAsync(process.argv);
}

main();
program.parse(process.argv);

0 comments on commit bcbbf5c

Please sign in to comment.