Skip to content

Commit

Permalink
exported formatters and utility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiDittrich committed Jan 31, 2021
1 parent 703c1ea commit d1e9ffa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

### 3.9.0 ###

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

### 3.8.2 ###

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,16 @@ is rendered as
# Task 1 200/200 --[████████████████████████████████████████]--
```


### Example 2 ###

You can also access the default format functions to use them within your formatter:

```js
const {TimeFormat, ValueFormat, BarFormat, Formatter} = require('cli-progess').Format;
...
```

Examples
---------------------------------------------

Expand Down
12 changes: 11 additions & 1 deletion cli-progress.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
const _SingleBar = require('./lib/single-bar');
const _MultiBar = require('./lib/multi-bar');
const _Presets = require('./presets/index');
const _Formatter = require('./lib/formatter');
const _defaultFormatValue = require('./lib/format-value');
const _defaultFormatBar = require('./lib/format-bar');
const _defaultFormatTime = require('./lib/format-time');

// sub-module access
module.exports = {
Bar: _SingleBar,
SingleBar: _SingleBar,
MultiBar: _MultiBar,
Presets: _Presets
Presets: _Presets,
Format: {
Formatter: _Formatter,
BarFormat: _defaultFormatBar,
ValueFormat: _defaultFormatValue,
TimeFormat: _defaultFormatTime
}
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cli-progress",
"version": "3.8.2",
"version": "3.9.0",
"description": "easy to use progress-bar for command-line/terminal applications",
"keywords": [
"cli",
Expand Down Expand Up @@ -32,7 +32,7 @@
"node": ">=4"
},
"main": "./cli-progress.js",
"author": "Andi Dittrich (https://andidittrich.de)",
"author": "Andi Dittrich (https://andidittrich.com)",
"license": "MIT",
"dependencies": {
"colors": "^1.1.2",
Expand Down

0 comments on commit d1e9ffa

Please sign in to comment.