add bin/tput.js

This commit is contained in:
Christopher Jeffrey 2013-02-24 12:14:12 -06:00
parent 06d6734622
commit 9b8983d355
3 changed files with 22 additions and 2 deletions

View File

@ -21,6 +21,15 @@ var Tput = require('blessed').Tput
console.log(tput.setaf(4) + 'hello' + tput.sgr0());
```
To play around with it on the command line, it works just like tput:
``` bash
$ tput.js setaf 2
$ tput.js sgr0
```
The higher level functionality is exposed in the main `blessed` module:
``` js
var blessed = require('blessed')
, program = blessed();

9
bin/tput.js Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env node
var tput = require('../lib/tput')(process.env.TERM || 'xterm')
, argv = process.argv.slice(2)
, cmd = argv.shift();
if (tput[cmd]) {
process.stdout.write(tput[cmd].apply(tput, argv));
}

View File

@ -4,10 +4,12 @@
"author": "Christopher Jeffrey",
"version": "0.0.3",
"main": "./lib/program.js",
"bin": "./bin/tput.js",
"preferGlobal": false,
"repository": "git://github.com/chjj/blessed.git",
"homepage": "https://github.com/chjj/blessed",
"bugs": { "url": "http://github.com/chjj/blessed/issues" },
"keywords": ["curses", "tui"],
"tags": ["curses", "tui"],
"keywords": ["curses", "tui", "tput"],
"tags": ["curses", "tui", "tput"],
"scripts": { "test": "node test", "bench": "node test --bench" }
}