1 // Generated by CoffeeScript 1.8.0
3 var COMMANDS, TAB, argv, c, command, fs, optimist, possibilities,
4 __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
8 optimist = require('optimist');
10 COMMANDS = ['cover', 'report'];
14 argv = optimist.usage("Usage: $0 subcommand\n=== subcommands ===\n" + TAB + (COMMANDS.join("\n" + TAB))).argv;
18 if (command == null) {
23 if (__indexOf.call(COMMANDS, command) < 0) {
24 possibilities = (function() {
25 var _i, _len, _results;
27 for (_i = 0, _len = COMMANDS.length; _i < _len; _i++) {
29 if (command === c.slice(0, command.length)) {
35 switch (possibilities.length) {
37 console.error("Unrecognised command: `" + command + "`. Run `" + argv['$0'] + "` for help.");
41 command = possibilities[0];
44 console.error("Ambiguous command `" + command + "` matches `" + (possibilities.join('`, `')) + "`");
49 (require("./" + command))(argv, function(err) {
54 return process.exit(0);