show version number

This commit is contained in:
cupcakearmy 2019-06-21 12:34:29 +02:00
parent 9538881f9f
commit 6a17444c4c
1 changed files with 11 additions and 4 deletions

View File

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