Skip to content

Instantly share code, notes, and snippets.

@mamachanko
Last active March 17, 2019 17:48
Show Gist options
  • Save mamachanko/9e1d9859b25f4593788ad5da3311ad65 to your computer and use it in GitHub Desktop.
Save mamachanko/9e1d9859b25f4593788ad5da3311ad65 to your computer and use it in GitHub Desktop.
blessed and SGR colors
node_modules
yarn.lock
import * as blessed from 'blessed';
import { spawn } from 'child_process';
const screen = blessed.screen({ smartCSR: true });
screen.title = 'git log with colors';
screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
const body = blessed.box({
tags: true
});
screen.append(body);
spawn('git', ['log']).stdout.on('data', data => {
body.pushLine(data.toString());
screen.render();
});
screen.render();
{
"dependencies": {
"@types/blessed": "^0.1.10",
"@types/node": "^11.11.3",
"blessed": "^0.1.81",
"ts-node": "^8.0.3",
"typescript": "^3.3.3333"
}
}
#!/usr/bin/env bash
set -euxo pipefail
cd $(dirname $0)
npx ts-node gitlog.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment