From 6a17444c4cc073485b9b056e8c0660615d137cf0 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Fri, 21 Jun 2019 12:34:29 +0200 Subject: [PATCH] show version number --- src/autorestic.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/autorestic.ts b/src/autorestic.ts index 6421d23..8f3f396 100644 --- a/src/autorestic.ts +++ b/src/autorestic.ts @@ -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() \ No newline at end of file