Permalink
Browse files

Pretty tasks listing

  • Loading branch information...
1 parent fbe0c24 commit 2beb85c452c97eac6644d5ff8e2f477f87291202 @MadRabbit MadRabbit committed with mde Mar 18, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/jake.js
View
@@ -468,13 +468,17 @@ jake = new function () {
var nsTasks = this.namespaceTasks;
var str = '';
var task;
+ var max_size = 0;
for (var p in nsTasks) {
for (var q in nsTasks[p]) {
task = nsTasks[p][q];
if (p != 'default') {
- str += p + ':';
+ q = p + ':' + q;
}
str += q + ' -- ';
+ if (max_size < q.length) {
+ max_size = q.length;
+ }
if (task.description) {
str += task.description;
}
@@ -484,6 +488,10 @@ jake = new function () {
str += '\n';
}
}
+ str = str.replace(/(.+?) -- ([^\n]+)/g, function(match, name, description) {
+ while (name.length < max_size) { name += ' '; }
+ return name + " \033[90m//"+ description +"\033[39m";
+ });
this.die(str);
};

0 comments on commit 2beb85c

Please sign in to comment.