1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Using console.error for errors instead of console.log

This commit is contained in:
Trevor Burnham 2011-11-13 14:54:37 -05:00
parent 1d7a3b4d0f
commit 79945ad473
2 changed files with 4 additions and 8 deletions

View file

@ -50,7 +50,6 @@
});
oparse = new optparse.OptionParser(switches);
if (!args.length) return printTasks();
console.log(args);
try {
options = oparse.parse(args);
} catch (e) {
@ -67,7 +66,6 @@
printTasks = function() {
var desc, name, spaces, task;
console.log('');
for (name in tasks) {
task = tasks[name];
spaces = 20 - name.length;
@ -79,12 +77,12 @@
};
missingOption = function(option) {
console.log("No such option: \"" + option + "\"");
console.error("No such option: \"" + option + "\"\n");
return process.exit(1);
};
missingTask = function(task) {
console.log("No such task: \"" + task + "\"");
console.error("No such task: \"" + task + "\"\n");
return process.exit(1);
};

View file

@ -50,7 +50,6 @@ exports.run = ->
CoffeeScript.run fs.readFileSync('Cakefile').toString(), filename: 'Cakefile'
oparse = new optparse.OptionParser switches
return printTasks() unless args.length
console.log args
try
options = oparse.parse(args)
catch e
@ -59,7 +58,6 @@ exports.run = ->
# Display the list of Cake tasks in a format similar to `rake -T`
printTasks = ->
console.log ''
for name, task of tasks
spaces = 20 - name.length
spaces = if spaces > 0 then Array(spaces + 1).join(' ') else ''
@ -69,12 +67,12 @@ printTasks = ->
# Print an error and exit when attempting to use an invalid option.
missingOption = (option) ->
console.log "No such option: \"#{option}\""
console.error """No such option: "#{option}"\n"""
process.exit 1
# Print an error and exit when attempting to call an undefined task.
missingTask = (task) ->
console.log "No such task: \"#{task}\""
console.error """No such task: "#{task}"\n"""
process.exit 1
# When `cake` is invoked, search in the current and all parent directories