快速構建好看的命令行界面的Node.js工具包:clui
這是一個Node.js的工具包,用于快速構建好看的命令行界面,可以響應不斷變化的終端尺寸。它還包括以下使用方便組件:
- Gauges
- Progress Bars
- Sparklines
- Spinners </ul>
var CLI = require('clui'), clc = require('cli-color'); var Line = CLI.Line, LineBuffer = CLI.LineBuffer; var outputBuffer = new LineBuffer({ x: 0, y: 0, width: 'console', height: 'console' }); var message = new Line(outputBuffer) .column('Title Placehole', 20, [clc.green]) .fill() .store(); var blankLine = new Line(outputBuffer) .fill() .store(); var header = new Line(outputBuffer) .column('Suscipit', 20, [clc.cyan]) .column('Voluptatem', 20, [clc.cyan]) .column('Nesciunt', 20, [clc.cyan]) .column('Laudantium', 11, [clc.cyan]) .fill() .store(); var line; for(var l = 0; l < 20; l++) { line = new Line(outputBuffer) .column((Math.random()*100).toFixed(3), 20) .column((Math.random()*100).toFixed(3), 20) .column((Math.random()*100).toFixed(3), 20) .column((Math.random()*100).toFixed(3), 11) .fill() .store(); } outputBuffer.output();
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!