#!/usr/bin/env node

var chalk = require('chalk');
var leftpad = require('left-pad');
var minimist = require('minimist');
var spinner = require('ora')('Loading...'); // TODO

var movieman = require('./dist');
var version = require('./package.json').version;

var defaults = {
  alias: {
    h: 'help',
    v: 'version'
  },
  boolean: ['help', 'version']
};

var help = `
  Usage
    $ movieman [OPTIONS] title

  Options
    -h --help      Display this help dialog.
    -v --version   Display the current version.

  Example
    $ movieman batman
`;

var options = minimist(process.argv.slice(2), defaults);

if (options.help) {
  console.log(help);
  process.exit(0);
} else if (options.version) {
  console.log('v' + version);
  process.exit(0);
}

var title = options._.join(' ');
if (!title) {
  console.error('Expected movie title. Run `movieman -h` for help.')
  process.exit(1);
}
// spinner.start();
// spinner.stop();
movieman.getMovie().by.title(title, function(err, res) {
  if (err) throw err;

  var keys = Object.keys(res);

  Object.keys(res).forEach(function(key) {
    console.log(key + chalk.yellow(leftpad('-›  ', 18 - key.length)) + res[key]);
  });
});

@@ -162,16 +162,8 @@
 .');
- // TODO
 %0A%0Ava
@@ -874,19 +874,17 @@
 t(1);%0A%7D%0A
-// 
+%0A
 spinner.
@@ -896,26 +896,8 @@
 ();%0A
-// spinner.stop();
 %0Amov
@@ -979,34 +979,21 @@
 %0A%0A  
-var keys = Object.keys(res
+spinner.stop(
 );%0A%0A

Add spinners