Permalink
Browse files

added echo and capture helper funtions to the console

  • Loading branch information...
1 parent 28e71c6 commit f0c7bc1f13088dbfc8f1e949a9ccec99e8362542 Techwraith committed Sep 29, 2012
Showing with 35 additions and 1 deletion.
  1. +35 −1 templates/Jakefile
View
@@ -64,9 +64,43 @@ namespace('console', function () {
});
rl.addListener('close', function () {
console.log('Exiting ...');
- complete();
+ return complete();
});
});
+
+ global.capture = function (err, data) {
+ return global.results = {
+ err: err
+ , data: data
+ };
+ }
+
+ global.echo = function (err, data) {
+ capture(err, data);
+ if (err) {
+ console.log('Error: ', err);
+ }
+ if (data) {
+ if (data.length) {
+ for (var i in data) {
+ if (data[i] && data[i].toData) {
+ console.log(data[i].toData());
+ } else {
+ console.log(data[i]);
+ }
+ }
+ } else {
+ if (data && data.toData) {
+ console.log(data.toData());
+ } else {
+ console.log(data);
+ }
+ }
+ } else {
+ console.log('No data');
+ }
+ }
+
t.invoke(env);
});
});

0 comments on commit f0c7bc1

Please sign in to comment.