jashkenas/coffee-script — pull request #1866 by TrevorBurnham (2011-11-13 20:37:04+00:00)
Title: Interface enhancements for cake (#1862)

On the current master, while using an invalid task name produces a simple message, an invalid option (flag) produces a stack trace, because the exception thrown by `OptionParser` isn't caught (#1862). This pull request corrects that, instead producing, for example:

> cake --help
No such option: "--help"

To see a list of all tasks/options, run "cake"

(The use of a regex in the implementation is admittedly kludgy—perhaps we should modify `OptionParser` to attach the invalid option name to the error object, or provide a method on the `OptionParser` instance to get such information.)

The other thing this patch does is preface the task list with a message like this:

Cakefile defines the following tasks:

This becomes useful when the relevant `Cakefile` is in a parent directory (feature introduced by #1687), as it will then say

../Cakefile defines the following tasks:

making things much easier for folks with a hierarchy of `Cakefile`s.