For better or worse, only the last program in the pipeline has access to the screen. At least, in that way. So my next step is to make a program that talks pipe. Here goes:
In
pigshell/src/cmd/jline.sh
I put:
function Jline(opts) {
var self = this;
self.countdown = 10;
Jline.base.call(self, opts);
}
inherit(Jline, Command);
Jline.prototype.usage =
[ 'jline'
, 'Usage:'
, ' jline'
].join("\n");
Jline.prototype.next = check_next(do_docopt(function(opts, cb) {
if (this.countdown--) this.output(this.countdown + " green bottles\n");
else this.exit(0);
}));
Command.register("jline", Jline);
Run make and hey presto:
No squealing! Great, but a bit black and white. Let's see whether we can add colour back in - after dinner!
No comments:
Post a Comment