On second thought, just saying 'run cake' on error rather than listing all options

This commit is contained in:
Trevor Burnham
2011-11-13 15:28:56 -05:00
parent a70753e6d3
commit 266d97f8f5
2 changed files with 12 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
(function() {
var CoffeeScript, cakefileDirectory, fs, helpers, missingOption, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
var CoffeeScript, badArgument, cakefileDirectory, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks;
fs = require('fs');
@@ -53,7 +53,7 @@
try {
options = oparse.parse(args);
} catch (e) {
return missingOption(("" + e).match(/option: (.+)/)[1]);
return badArgument(("" + e).match(/option: (.+)/)[1], "option");
}
_ref = options.arguments;
_results = [];
@@ -78,16 +78,14 @@
if (switches.length) return console.log(oparse.help());
};
missingOption = function(option) {
console.error("No such option: \"" + option + "\"\n");
printTasks();
badArgument = function(arg, type) {
console.error("No such " + type + ": \"" + arg + "\"\n");
console.log('To see a list of all tasks/options, run "cake"');
return process.exit(1);
};
missingTask = function(task) {
console.error("No such task: \"" + task + "\"\n");
printTasks();
return process.exit(1);
return badArgument(task, "task");
};
cakefileDirectory = function(dir) {