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

View file

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