#!/usr/bin/env node
const { argv } = require('yargs');
const { exportToGit, importFromGit } = require('./');

const {
    _: [type],
    host,
    port,
    db,
    repo,
    branch,
    tmpDir,
    userName,
    userEmail,
    daemonize,
    undaemonize,
    interval,
    checkout,
} = argv;

const options = {
    host,
    port,
    db,
    repo,
    branch,
    tmpDir,
    userName,
    userEmail,
    daemonize,
    undaemonize,
    interval,
    checkout,
};

if (!db) {
    throw Error('--db parameter is required');
}

if (!repo) {
    throw Error('--repo parameter is required');
}

if (type === 'export') {
    exportToGit(options);
} else if (type === 'import') {
    importFromGit(options);
} else {
    throw Error(`Bad type parameter "${type}"`);
}

@@ -48,16 +48,54 @@
 args');%0A
+const package = require('./package');%0A
 const %7B 
@@ -164,16 +164,29 @@
 %5Btype%5D,%0A
+    version,%0A
     host
@@ -512,16 +512,77 @@
 ut,%0A%7D;%0A%0A
+if(version) %7B%0A    console.log(package.version);%0A%7D else %7B%0A    
 if (!db)
@@ -580,24 +580,28 @@
  if (!db) %7B%0A
+    
     throw Er
@@ -631,27 +631,35 @@
 required');%0A
-%7D%0A%0A
+    %7D%0A%0A    
 if (!repo) %7B
@@ -655,24 +655,28 @@
 f (!repo) %7B%0A
+    
     throw Er
@@ -712,19 +712,27 @@
 ired');%0A
-%7D%0A%0A
+    %7D%0A%0A    
 if (type
@@ -744,24 +744,28 @@
 'export') %7B%0A
+    
     exportTo
@@ -774,24 +774,28 @@
 t(options);%0A
+    
 %7D else if (t
@@ -810,24 +810,28 @@
 'import') %7B%0A
+    
     importFr
@@ -846,16 +846,20 @@
 tions);%0A
+    
 %7D else %7B
@@ -855,24 +855,28 @@
    %7D else %7B%0A
+    
     throw Er
@@ -912,10 +912,16 @@
 pe%7D%22%60);%0A
+    %7D%0A
 %7D%0A

Add --version flag