'use strict' var consoleControl = require('console-control-strings') var renderTemplate = require('./render-template.js') var validate = require('aproba') var Plumbing = module.exports = function (theme, template, width) { if (!width) width = 80 validate('OAN', [theme, template, width]) this.showing = false this.theme = theme this.width = width this.template = template } Plumbing.prototype = {} Plumbing.prototype.setTheme = function (theme) { validate('O', [theme]) this.theme = theme } Plumbing.prototype.setTemplate = function (template) { validate('A', [template]) this.template = template } Plumbing.prototype.setWidth = function (width) { validate('N', [width]) this.width = width } Plumbing.prototype.hide = function () { return consoleControl.gotoSOL() + consoleControl.eraseLine() } Plumbing.prototype.hideCursor = consoleControl.hideCursor Plumbing.prototype.showCursor = consoleControl.showCursor Plumbing.prototype.show = function (status) { var values = Object.create(this.theme) for (var key in status) { values[key] = status[key] } return renderTemplate(this.width, this.template, values).trim() + consoleControl.color('reset') + consoleControl.eraseLine() + consoleControl.gotoSOL() }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
node_modules | Folder | 0755 |
|
|
CHANGELOG.md | File | 6.23 KB | 0644 |
|
LICENSE | File | 751 B | 0644 |
|
README.md | File | 14.72 KB | 0644 |
|
base-theme.js | File | 395 B | 0644 |
|
error.js | File | 616 B | 0644 |
|
has-color.js | File | 292 B | 0644 |
|
index.js | File | 6.83 KB | 0644 |
|
package.json | File | 2.13 KB | 0644 |
|
plumbing.js | File | 1.24 KB | 0644 |
|
process.js | File | 89 B | 0644 |
|
progress-bar.js | File | 998 B | 0644 |
|
render-template.js | File | 5.6 KB | 0644 |
|
set-immediate.js | File | 139 B | 0644 |
|
set-interval.js | File | 93 B | 0644 |
|
spin.js | File | 105 B | 0644 |
|
template-item.js | File | 1.86 KB | 0644 |
|
theme-set.js | File | 3.61 KB | 0644 |
|
themes.js | File | 1.51 KB | 0644 |
|
wide-truncate.js | File | 828 B | 0644 |
|