mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 08:16:25 +00:00
cleaner error handling & version bump
This commit is contained in:
parent
22d93f0b9c
commit
8fdf5188ff
@ -25,20 +25,22 @@ export const { _: commands, ...flags } = minimist(process.argv.slice(2), {
|
|||||||
string: ['l', 'b'],
|
string: ['l', 'b'],
|
||||||
})
|
})
|
||||||
|
|
||||||
export const VERSION = '0.11'
|
export const VERSION = '0.12'
|
||||||
export const INSTALL_DIR = '/usr/local/bin'
|
export const INSTALL_DIR = '/usr/local/bin'
|
||||||
export const VERBOSE = flags.verbose
|
export const VERBOSE = flags.verbose
|
||||||
|
|
||||||
export const config = init()
|
export const config = init()
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
async function main() {
|
||||||
if (commands.length < 1) return help()
|
if (commands.length < 1) return help()
|
||||||
|
|
||||||
const command: string = commands[0]
|
const command: string = commands[0]
|
||||||
const args: string[] = commands.slice(1)
|
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))
|
||||||
|
Loading…
Reference in New Issue
Block a user