1
- # ascii-progress
1
+ < h1 align = " center " > ascii-progress</ h1 >
2
2
3
- > Ascii progress-bar(s) in the terminal.
3
+ < p align = " center " >< strong > Ascii progress-bar(s) in the terminal.</ strong ></ p >
4
4
5
- [ ![ MIT License] ( https://img.shields.io/badge/license-MIT_License-green.svg?style=flat-square )] ( https://github.com/bubkoo/ascii-progress/blob/master/LICENSE )
6
- [ ![ Package Quality] ( http://npm.packagequality.com/shield/ascii-progress.svg )] ( http://packagequality.com/#?package=ascii-progress )
5
+ <p align =" center " >Fork from <a href =" https://github.com/tsayen/dom-to-image " rel =" nofollow " >dom-to-image</a > with more maintainable code and some new features.</p >
7
6
7
+ <p align =" center " >
8
+ <a href =" /LICENSE " ><img src =" https://img.shields.io/github/license/bubkoo/ascii-progress?style=flat-square " alt =" MIT License " ></a >
9
+ <a href =" https://www.typescriptlang.org " ><img alt =" Language " src =" https://img.shields.io/badge/language-TypeScript-blue.svg?style=flat-square " ></a >
10
+ <a href =" https://github.com/bubkoo/ascii-progress/pulls " ><img alt =" PRs Welcome " src =" https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=flat-square " ></a >
11
+
12
+ </p >
8
13
9
14
** Feature** :
10
15
@@ -28,14 +33,14 @@ $ npm install ascii-progress
28
33
> For more usage see the [ examples] ( https://github.com/bubkoo/ascii-progress/blob/master/examples )
29
34
30
35
``` javascript
31
- var ProgressBar = require (' ascii-progress' );
36
+ const { ProgressBar } = require (' ascii-progress' );
32
37
33
- var bar = new ProgressBar ({
38
+ const bar = new ProgressBar ({
34
39
schema: ' :bar' ,
35
- total : 10
40
+ total : 10 ,
36
41
});
37
42
38
- var iv = setInterval (function () {
43
+ const iv = setInterval (function () {
39
44
bar .tick ();
40
45
if (bar .completed ) {
41
46
clearInterval (iv);
@@ -46,9 +51,7 @@ var iv = setInterval(function () {
46
51
47
52
### Options
48
53
49
- These are keys in the options object you can pass to the progress bar along with
50
- ` total ` as seen in the example above.
51
-
54
+ These are keys in the options object you can pass to the progress bar along with ` total ` as seen in the example above.
52
55
53
56
- ` schema ` - template string of the progress bar. Default ` " [:bar] :current/:total :percent :elapseds :etas'" ` .
54
57
- ` total ` - total number of ticks to complete. Default ` 100 ` .
@@ -62,35 +65,22 @@ These are keys in the options object you can pass to the progress bar along with
62
65
63
66
64
67
### Properties
65
-
66
68
- ` schema `
67
69
- ` total `
68
70
- ` current `
69
71
- ` completed `
70
72
71
73
### Methods
72
74
73
- #### ` setSchema(schema, refresh/tokens) `
74
-
75
- Update the schema of the progress bar. If ` refresh ` or ` tokens ` is truely the progress bar will be refreshed.
76
-
77
- #### ` tick(delta, tokens) `
78
-
79
- Update ticks of the progress bar by ` delta ` , then render the progress bar with optional ` tokens ` .
80
-
81
- #### ` update(ratio, tokens) `
82
-
83
- Update the progress bar to ` ratio ` by percentage, then render the progress bar with optional ` tokens ` .
84
-
85
- #### ` clear() `
86
-
87
- Clean the progress bar in the terminal.
75
+ - ` setSchema(schema, refresh/tokens) ` - Update the schema of the progress bar. If ` refresh ` or ` tokens ` is truely the progress bar will be refreshed.
76
+ - ` tick(delta, tokens) ` - Update ticks of the progress bar by ` delta ` , then render the progress bar with optional ` tokens ` .
77
+ - ` update(ratio, tokens) ` - Update the progress bar to ` ratio ` by percentage, then render the progress bar with optional ` tokens ` .
88
78
79
+ - ` clear() ` - Clean the progress bar in the terminal.
89
80
90
81
## Schema
91
82
92
- The schema defines appearance the progress bar. Few inner tokens and many
93
- formatting methods can be used to customer you progress bar.
83
+ The schema defines appearance the progress bar. Few inner tokens and many formatting methods can be used to customer you progress bar.
94
84
95
85
### Tokens
96
86
@@ -110,9 +100,9 @@ These are tokens you can use in the format of your progress bar.
110
100
You can define custom tokens by adding a ` {name: value} ` object parameter to your method (` tick() ` , ` update() ` , etc.) calls.
111
101
112
102
``` javascript
113
- var bar = new ProgressBar ({
103
+ const bar = new ProgressBar ({
114
104
schema: ' :current: :token1 :token2' ,
115
- total : 3
105
+ total : 3 ,
116
106
});
117
107
bar .tick ({
118
108
' token1' : " Hello" ,
@@ -207,7 +197,15 @@ The percentage is green and bold.
207
197
208
198
## Contributing
209
199
210
- Pull requests and stars are highly welcome.
200
+ Please let us know how can we help. Do check out [ issues] ( https://github.com/bubkoo/ascii-progress/issues ) for bug reports or suggestions first.
201
+
202
+ To become a contributor, please follow our [ contributing guide] ( /CONTRIBUTING.md ) .
203
+
204
+ <a href =" https://github.com/bubkoo/ascii-progress/graphs/contributors " >
205
+ <img src =" /CONTRIBUTORS.svg " alt =" Contributors " width =" 740 " />
206
+ </a >
207
+
211
208
212
- For bugs and feature requests, please [ create an issue ] ( https://github.com/bubkoo/ascii-progress/issues/new ) .
209
+ ## License
213
210
211
+ The scripts and documentation in this project are released under the [ MIT License] ( LICENSE )
0 commit comments