show version number

This commit is contained in:
cupcakearmy 2019-06-21 12:34:29 +02:00
parent 9538881f9f
commit 6a17444c4c

View File

@ -26,7 +26,7 @@ export const { _: commands, ...flags } = minimist(process.argv.slice(2), {
string: ['l', 'b'], string: ['l', 'b'],
}) })
export const VERSION = '0.3' export const VERSION = '0.4'
export const DEFAULT_CONFIG = '/.autorestic.yml' export const DEFAULT_CONFIG = '/.autorestic.yml'
export const INSTALL_DIR = '/usr/local/bin' export const INSTALL_DIR = '/usr/local/bin'
export const CONFIG_FILE: string = resolve(flags.config || homedir() + DEFAULT_CONFIG) export const CONFIG_FILE: string = resolve(flags.config || homedir() + DEFAULT_CONFIG)
@ -34,10 +34,17 @@ export const VERBOSE = flags.verbose
export const config: Config = init() export const config: Config = init()
if (commands.length < 1) function main() {
help() if (flags.version)
else { return console.log('version'.grey, VERSION)
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) ;(handlers[command] || error)(args, flags)
} }
main()