Skip to content
Browse files

Pretty tasks listing

  • Loading branch information...
1 parent fbe0c24 commit 6648642af640e6a81d2b06de28738082913795c8 @MadRabbit committed Mar 18, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/jake.js
View
10 lib/jake.js
@@ -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 6648642

Please sign in to comment.
Something went wrong with that request. Please try again.