Skip to content

Commit d1e9ffa

Browse files
committed
exported formatters and utility functions
1 parent 703c1ea commit d1e9ffa

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
### 3.9.0 ###
44

5+
* Added: exported standard formatter and format helper
56
* Added: example howto use multibars in synchronous context
6-
* Changed: upper eta display limit to `1e7` (115days)
7+
* Changed: upper eta display limit to `1e7` (115days) #92
78

89
### 3.8.2 ###
910

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@ is rendered as
321321
# Task 1 200/200 --[████████████████████████████████████████]--
322322
```
323323

324+
325+
### Example 2 ###
326+
327+
You can also access the default format functions to use them within your formatter:
328+
329+
```js
330+
const {TimeFormat, ValueFormat, BarFormat, Formatter} = require('cli-progess').Format;
331+
...
332+
```
333+
324334
Examples
325335
---------------------------------------------
326336

cli-progress.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
const _SingleBar = require('./lib/single-bar');
22
const _MultiBar = require('./lib/multi-bar');
33
const _Presets = require('./presets/index');
4+
const _Formatter = require('./lib/formatter');
5+
const _defaultFormatValue = require('./lib/format-value');
6+
const _defaultFormatBar = require('./lib/format-bar');
7+
const _defaultFormatTime = require('./lib/format-time');
48

59
// sub-module access
610
module.exports = {
711
Bar: _SingleBar,
812
SingleBar: _SingleBar,
913
MultiBar: _MultiBar,
10-
Presets: _Presets
14+
Presets: _Presets,
15+
Format: {
16+
Formatter: _Formatter,
17+
BarFormat: _defaultFormatBar,
18+
ValueFormat: _defaultFormatValue,
19+
TimeFormat: _defaultFormatTime
20+
}
1121
};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cli-progress",
3-
"version": "3.8.2",
3+
"version": "3.9.0",
44
"description": "easy to use progress-bar for command-line/terminal applications",
55
"keywords": [
66
"cli",
@@ -32,7 +32,7 @@
3232
"node": ">=4"
3333
},
3434
"main": "./cli-progress.js",
35-
"author": "Andi Dittrich (https://andidittrich.de)",
35+
"author": "Andi Dittrich (https://andidittrich.com)",
3636
"license": "MIT",
3737
"dependencies": {
3838
"colors": "^1.1.2",

0 commit comments

Comments
 (0)