text: // Generated by CoffeeScript 1.8.0
  (function() {
    var epipeFilter, formatters, program, tutor;
  
    formatters = require('./formatters');
  
    tutor = require('./tutor');
  
    epipeFilter = function(err) {
      if (err.code === 'EPIPE') {
        process.exit();
      }
      if (process.stdout.listeners('error').length <= 1) {
        process.stdout.removeAllListeners();
        process.stdout.emit('error', err);
        return process.stdout.on('error', epipeFilter);
      }
    };
  
    process.stdout.on('error', epipeFilter);
  
    program = require('commander');
  
    program.version(require('../package').version);
  
    ['formats', 'sets', 'types'].forEach(function(resource) {
      return program.command(resource).option('-f, --format [formatter]', '"json" or "summary"', 'summary').action(function(options) {
        return tutor[resource](formatters[resource][options.format]);
      });
    });
  
    program.command('card <name|id>').description("output the given card's details").option('-f, --format [formatter]', '"json" or "summary"', 'summary').action(function(value, options) {
      return tutor.card((+value === +value ? +value : value), formatters.card[options.format]);
    });
  
    program.command('set <name>').description('output one page of cards from the named set').option('-f, --format [formatter]', '"json" or "summary"', 'summary').action(function(name, options) {
      return tutor.set(name, formatters.set[options.format]);
    });
  
    module.exports = program;
  
  }).call(this);
  