From 8fdf5188ff72b70e4d0cdc2435d0a92ce45e0898 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sun, 22 Dec 2019 14:26:27 +0100 Subject: [PATCH] cleaner error handling & version bump --- src/autorestic.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/autorestic.ts b/src/autorestic.ts index ad53663..6f132c1 100644 --- a/src/autorestic.ts +++ b/src/autorestic.ts @@ -25,20 +25,22 @@ export const { _: commands, ...flags } = minimist(process.argv.slice(2), { string: ['l', 'b'], }) -export const VERSION = '0.11' +export const VERSION = '0.12' export const INSTALL_DIR = '/usr/local/bin' export const VERBOSE = flags.verbose export const config = init() -function main() { +async function main() { if (commands.length < 1) return help() const command: string = commands[0] const args: string[] = commands.slice(1) - ;(handlers[command] || error)(args, flags) + + const fn = handlers[command] || error + await fn(args, flags) } -main() +main().catch((e: Error) => console.error(e.message))