Skip to content

Commit

Permalink
On second thought, just saying 'run cake' on error rather than listin…
Browse files Browse the repository at this point in the history
…g all options
  • Loading branch information
TrevorBurnham committed Nov 13, 2011
1 parent a70753e commit 266d97f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
14 changes: 6 additions & 8 deletions lib/coffee-script/cake.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 6 additions & 10 deletions src/cake.coffee
Expand Up @@ -53,7 +53,7 @@ exports.run = ->
try
options = oparse.parse(args)
catch e
return missingOption "#{e}".match(/option: (.+)/)[1]
return badArgument "#{e}".match(/option: (.+)/)[1], "option"
invoke arg for arg in options.arguments

# Display the list of Cake tasks in a format similar to `rake -T`
Expand All @@ -67,17 +67,13 @@ printTasks = ->
console.log "cake #{name}#{spaces} #{desc}"
console.log oparse.help() if switches.length

# Print an error and exit when attempting to use an invalid option.
missingOption = (option) ->
console.error """No such option: "#{option}"\n"""
printTasks()
# Print an error and exit when attempting to use an invalid task/option.
badArgument = (arg, type) ->
console.error """No such #{type}: "#{arg}"\n"""
console.log 'To see a list of all tasks/options, run "cake"'
process.exit 1

# Print an error and exit when attempting to call an undefined task.
missingTask = (task) ->
console.error """No such task: "#{task}"\n"""
printTasks()
process.exit 1
missingTask = (task) -> badArgument task, "task"

# When `cake` is invoked, search in the current and all parent directories
# to find the relevant Cakefile.
Expand Down

0 comments on commit 266d97f

Please sign in to comment.