Last active
March 17, 2019 17:48
-
-
Save mamachanko/9e1d9859b25f4593788ad5da3311ad65 to your computer and use it in GitHub Desktop.
blessed and SGR colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"@types/blessed": "^0.1.10", | |
"@types/node": "^11.11.3", | |
"blessed": "^0.1.81", | |
"ts-node": "^8.0.3", | |
"typescript": "^3.3.3333" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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