mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
Optional sentence descriptions for cake tasks.
This commit is contained in:
16
lib/cake.js
16
lib/cake.js
@@ -20,9 +20,15 @@
|
||||
oparse = null;
|
||||
// Mixin the top-level Cake functions for Cakefiles to use directly.
|
||||
helpers.extend(global, {
|
||||
// Define a Cake task with a short name, a sentence description,
|
||||
// Define a Cake task with a short name, an optional sentence description,
|
||||
// and the function to run as the action itself.
|
||||
task: function task(name, description, action) {
|
||||
var _a;
|
||||
if (!((typeof action !== "undefined" && action !== null))) {
|
||||
_a = [description, action];
|
||||
action = _a[0];
|
||||
description = _a[1];
|
||||
}
|
||||
tasks[name] = {
|
||||
name: name,
|
||||
description: description,
|
||||
@@ -72,7 +78,7 @@
|
||||
};
|
||||
// Display the list of Cake tasks in a format similar to `rake -T`
|
||||
print_tasks = function print_tasks() {
|
||||
var _a, _b, _c, _d, _e, _f, i, name, spaces, task;
|
||||
var _a, _b, _c, _d, _e, _f, _g, i, name, spaces, task;
|
||||
puts('');
|
||||
_a = tasks;
|
||||
for (name in _a) { if (__hasProp.call(_a, name)) {
|
||||
@@ -85,7 +91,11 @@
|
||||
}
|
||||
return _b;
|
||||
}).call(this).join('') : '';
|
||||
puts("cake " + name + spaces + " # " + (task.description));
|
||||
print("cake " + name + spaces);
|
||||
if ((typeof (_g = task.description) !== "undefined" && _g !== null)) {
|
||||
print(" # " + (task.description));
|
||||
}
|
||||
puts('');
|
||||
}}
|
||||
if (switches.length) {
|
||||
return puts(oparse.help());
|
||||
|
||||
Reference in New Issue
Block a user