{"name":"gauge","version":"1.2.2","description":"A terminal based horizontal guage","main":"progress-bar.js","scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/iarna/gauge"},"keywords":["progressbar","progress","gauge"],"author":{"name":"Rebecca Turner","email":"me@re-becca.org"},"license":"ISC","bugs":{"url":"https://github.com/iarna/gauge/issues"},"homepage":"https://github.com/iarna/gauge","dependencies":{"ansi":"^0.3.0","has-unicode":"^1.0.0","lodash.pad":"^3.0.0","lodash.padleft":"^3.0.0","lodash.padright":"^3.0.0"},"devDependencies":{"tap":"^0.4.13"},"readme":"gauge\n=====\n\nA nearly stateless terminal based horizontal guage / progress bar.\n\n```javascript\nvar Gauge = require(\"gauge\")\n\nvar gauge = new Gauge()\n\ngauge.show(\"test\", 0.20)\n\ngauge.pulse(\"this\")\n\ngauge.hide()\n```\n\n![](example.png)\n\n\n### `var gauge = new Gauge([options], [ansiStream])`\n\n* **options** – *(optional)* An option object. (See [below] for details.)\n* **ansiStream** – *(optional)* A stream that's been blessed by the [ansi]\n  module to include various commands for controlling the cursor in a terminal.\n\n[ansi]: https://www.npmjs.com/package/ansi\n[below]: #theme-objects\n\nConstructs a new gauge. Gauges are drawn on a single line, and are not drawn\nif the current terminal isn't a tty.\n\nIf you resize your terminal in a way that can be detected then the gauge\nwill be drawn at the new size. As a general rule, growing your terminal will\nbe clean, but shrinking your terminal will result in cruft as we don't have\nenough information to know where what we wrote previously is now located.\n\nThe **options** object can have the following properties, all of which are\noptional:\n\n* maxUpdateFrequency: defaults to 50 msec, the gauge will not be drawn more\n  than once in this period of time. This applies to `show` and `pulse`\n  calls, but if you `hide` and then `show` the gauge it will draw it\n  regardless of time since last draw.\n* theme: defaults to Gauge.unicode` if the terminal supports\n  unicode according to [has-unicode], otherwise it defaults to `Gauge.ascii`.\n  Details on the [theme object](#theme-objects) are documented elsewhere.\n* template: see [documentation elsewhere](#template-objects) for\n  defaults and details.\n\n[has-unicode]: https://www.npmjs.com/package/has-unicode\n\nIf **ansiStream** isn't passed in, then one will be constructed from stderr\nwith `ansi(process.stderr)`.\n\n### `gauge.show([name, [completed]])`\n\n* **name** – *(optional)* The name of the current thing contributing to progress. Defaults to the last value used, or \"\".\n* **completed** – *(optional)* The portion completed as a value between 0 and 1. Defaults to the last value used, or 0.\n\nIf `process.stdout.isTTY` is false then this does nothing. If completed is 0\nand `gauge.pulse` has never been called, then similarly nothing will be printed.\n\nIf `maxUpdateFrequency` msec haven't passed since the last call to `show` or\n`pulse` then similarly, nothing will be printed.  (Actually, the update is\ndeferred until `maxUpdateFrequency` msec have passed and if nothing else has\nhappened, the gauge update will happen.)\n\n### `gauge.hide()`\n\nRemoves the gauge from the terminal.\n\n### `gauge.pulse([name])`\n\n* **name** – *(optional)* The specific thing that triggered this pulse\n\nSpins the spinner in the gauge to show output. If **name** is included then\nit will be combined with the last name passed to `gauge.show` using the\nsubsection property of the theme (typically a right facing arrow).\n\n### `gauge.disable()`\n\nHides the gauge and ignores further calls to `show` or `pulse`.\n\n### `gauge.enable()`\n\nShows the gauge and resumes updating when `show` or `pulse` is called.\n\n### `gauge.setTheme(theme)`\n\nChange the active theme, will be displayed with the next show or pulse\n\n### `gauge.setTemplate(template)`\n\nChange the active template, will be displayed with the next show or pulse\n\n### Theme Objects\n\nThere are two theme objects available as a part of the module, `Gauge.unicode` and `Gauge.ascii`.\nTheme objects have the follow properties:\n\n| Property   | Unicode | ASCII |\n| ---------- | ------- | ----- |\n| startgroup | ╢       | \\|    |\n| endgroup   | ╟       | \\|    |\n| complete   | █       | #     |\n| incomplete | ░       | -     |\n| spinner    | ▀▐▄▌    | -\\\\\\|/ |\n| subsection | →       | ->    |\n\n*startgroup*, *endgroup* and *subsection* can be as many characters as you want.\n\n*complete* and *incomplete* should be a single character width each.\n\n*spinner* is a list of characters to use in turn when displaying an activity\nspinner.  The Gauge will spin as many characters as you give here.\n\n### Template Objects\n\nA template is an array of objects and strings that, after being evaluated,\nwill be turned into the gauge line.  The default template is:\n\n```javascript\n[\n    {type: \"name\", separated: true, maxLength: 25, minLength: 25, align: \"left\"},\n    {type: \"spinner\", separated: true},\n    {type: \"startgroup\"},\n    {type: \"completionbar\"},\n    {type: \"endgroup\"}\n]\n```\n\nThe various template elements can either be **plain strings**, in which case they will\nbe be included verbatum in the output.\n\nIf the template element is an object, it can have the following keys:\n\n* *type* can be:\n  * `name` – The most recent name passed to `show`; if this is in response to a\n    `pulse` then the name passed to `pulse` will be appended along with the\n    subsection property from the theme.\n  * `spinner` – If you've ever called `pulse` this will be one of the characters\n    from the spinner property of the theme.\n  * `startgroup` – The `startgroup` property from the theme.\n  * `completionbar` – This progress bar itself\n  * `endgroup` – The `endgroup` property from the theme.\n* *separated* – If true, the element will be separated with spaces from things on\n  either side (and margins count as space, so it won't be indented), but only\n  if its included.\n* *maxLength* – The maximum length for this element. If its value is longer it\n  will be truncated.\n* *minLength* – The minimum length for this element. If its value is shorter it\n  will be padded according to the *align* value.\n* *align* – (Default: left) Possible values \"left\", \"right\" and \"center\". Works\n  as you'd expect from word processors.\n* *length* – Provides a single value for both *minLength* and *maxLength*. If both\n  *length* and *minLength or *maxLength* are specifed then the latter take precedence.\n\n### Tracking Completion\n\nIf you have more than one thing going on that you want to track completion\nof, you may find the related [are-we-there-yet] helpful.  It's `change`\nevent can be wired up to the `show` method to get a more traditional\nprogress bar interface.\n\n[are-we-there-yet]: https://www.npmjs.com/package/are-we-there-yet\n","readmeFilename":"README.md","_id":"gauge@1.2.2","_shasum":"05b6730a19a8fcad3c340a142f0945222a3f815b","_from":"https://registry.npmjs.org/gauge/-/gauge-1.2.2.tgz","_resolved":"https://registry.npmjs.org/gauge/-/gauge-1.2.2.tgz"}