Optional sentence descriptions for cake tasks.

This commit is contained in:
Chris Lloyd
2010-03-26 20:25:17 +11:00
parent c8f969b4a2
commit c9b6e82e2c
2 changed files with 18 additions and 5 deletions

View File

@@ -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());