LoginSignup
26
22

More than 5 years have passed since last update.

Node.js CLI/TUI ライブラリ一覧

Last updated at Posted at 2015-03-09

はじめに

ここで紹介してるライブラリはほとんど全角文字に対応していないので、日本語を使うと表示が崩れます。

ライブラリ

blessed

https://github.com/chjj/blessed
テキストユーザインタフェースを作る ncurses 的なやつ

追記 2015/4/18
blesseed v0.1.1 で日本語もサポートされるようになりました。
表示が崩れない

blessed-jp.coffee
blessed = require "blessed"

screen = blessed.screen {
  fullUnicode: true
}
screen.key "q", -> process.exit()

list = blessed.list
  style: selected: bg: "blue"
  keys: true
  vi: true

screen.append list
list.add "hoge"
list.add "あいうえお"
list.add "fuga"
screen.render()

Sparkline

https://github.com/shiwano/sparkline
▁█▄▆▂ <- こんな感じのデコボコ作る奴

drawille

https://github.com/madbence/node-drawille
https://github.com/madbence/node-drawille-canvas
点字使って図形

blessed-contrib

https://github.com/yaronn/blessed-contrib
blessed に Sparkline, drawille を使ったウィジェット追加したやつ

cli-table

https://github.com/Automattic/cli-table
簡単な表を作る

node-progress

https://github.com/tj/node-progress
プログレスバーを表示する

progress.coffee
ProgressBar = require "progress"

bar = new ProgressBar ":bar :current/:total", {
  total: 10
  width: 20
}

do f = ->
  bar.tick()
  setTimeout f, 100 unless bar.complete

East Asian Width

https://github.com/komagata/eastasianwidth
文字列の幅を計算するライブラリ
日本語に対応した物を作りたい場合は必須

おまけ: TUI アプリ

vtop

https://github.com/MrRio/vtop
blessed とか使って top コマンドをいい感じにしたやつ

✋ slap

https://github.com/slap-editor/slap
sublime 風のテキストエディタを blessed を使用して実装

python3がデフォのOSの場合以下のコマンドでインストールする
sudo npm i -g slap --python=python2

終了は Ctrl-q で

26
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
22