'use strict';
var argv  = process.argv;
var chest = require('./main');
var pkg = require(__dirname + '/../package.json');
var updateNotifier = require('update-notifier');

updateNotifier({
    packageName: pkg.name,
    packageVersion: pkg.version
}).notify();

if(argv[2] !== void 0) {
  switch (argv[2]) {
  case 'usage':
    if (argv.length === 3) {
      chest.usage();
      break;
    }
  case 'put':
    if (argv.length > 3) {
      argv.splice(0, 3);
      chest.put(argv);
      break;
    }
  case 'take':
    if (argv.length > 3) {
      argv.splice(0, 3);
      chest.take(argv);
      break;
    }
  case 'open':
    if (argv.length === 3) {
      chest.open();
      break;
    }
  case 'list':
    if (argv.length === 3) {
      chest.list();
      break;
    }
  case 'close':
    if (argv.length === 3) {
      chest.close();
      break;
    }
  default:
    var message = 'Unrecognized command line argument: ';
    message += argv[2];
    message += ' ( see: \'chest usage\' )';
    console.log(message);
    break;
  }
} else {
  console.log('@see \'chest usage\'\n');
}

'use strict';
var chest = require('./main')
var pkg = require(__dirname + '/../package.json')
var updateNotifier = require('update-notifier')
var program = require('commander')

updateNotifier({
  packageName: pkg.name,
  packageVersion: pkg.version
}).notify()

program
  .version(pkg.version)

program
  .command('put [files]')
  .description('Put specified config file in the chest')
  .action(function (files) {
    chest.put(files)
  })

program
  .command('take [files]')
  .description('Take specified config file from the chest into the project root')
  .action(function (files) {
    chest.put(files)
  })

program
  .command('list')
  .description('Show list of config files in the chest')
  .action(chest.list)

program
  .command('open')
  .description('Place config files from the chest into the project root as symbolic links')
  .action(chest.open)

program
  .command('close')
  .description('Remove symbolic links created by "open"')
  .action(chest.close)

program.parse(process.argv)

if (program.args.length === 0) program.help()

make cli.js simple