#!/usr/bin/env node
const { getLocalIdyll } = require('./util');

require('yargs')
  .usage('Usage: idyll <command> [options]')
  .commandDir('cmds')
  .demandCommand()
  .help()
  .version(function() {
    console.log('Global idyll version:', require('../package').version);
    const localIdyllPath = getLocalIdyll();
    if (localIdyllPath) {
      console.log('Local idyll version:', require(localIdyllPath).getVersion());
    }
    return process.exit();
  }).argv;

@@ -57,16 +57,43 @@
 /util');
+%0Aconst p = require('path');
 %0A%0Arequir
@@ -362,24 +362,38 @@
 dyllPath) %7B%0A
+      try %7B%0A  
       consol
@@ -398,16 +398,27 @@
 ole.log(
+%0A          
 'Local i
@@ -424,32 +424,42 @@
 idyll version:',
+%0A         
  require(localId
@@ -479,18 +479,187 @@
 ersion()
-);
+%0A        );%0A      %7D catch (e) %7B%0A        console.log(%0A          'Local idyll version:',%0A          require(p.join(localIdyllPath, 'package.json')).version%0A        );%0A      %7D
 %0A    %7D%0A 

make backwards compatible