MCPcopy Create free account
hub / github.com/npkgz/cli-progress / start

Method start

lib/single-bar.js:62–93  ·  view source on GitHub ↗
(total, startValue, payload)

Source from the content-addressed store, hash-verified

60
61 // start the progress bar
62 start(total, startValue, payload){
63 // progress updates are only visible in TTY mode!
64 if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){
65 return;
66 }
67
68 // add handler to restore cursor settings (stop the bar) on SIGINT/SIGTERM ?
69 if (this.sigintCallback === null && this.options.gracefulExit){
70 this.sigintCallback = this.stop.bind(this);
71 process.once('SIGINT', this.sigintCallback);
72 process.once('SIGTERM', this.sigintCallback);
73 }
74
75 // save current cursor settings
76 this.terminal.cursorSave();
77
78 // hide the cursor ?
79 if (this.options.hideCursor === true){
80 this.terminal.cursor(false);
81 }
82
83 // disable line wrapping ?
84 if (this.options.linewrap === false){
85 this.terminal.lineWrapping(false);
86 }
87
88 // initialize bar
89 super.start(total, startValue, payload);
90
91 // redraw on start!
92 this.render();
93 }
94
95 // stop the bar
96 stop(){

Callers 14

createMethod · 0.45
infinite.jsFile · 0.45
showPresetFunction · 0.45
showPresetFunction · 0.45
runSinglebarFunction · 0.45
Example5Function · 0.45
Example5Function · 0.45
Example1Function · 0.45
Example2Function · 0.45
Example3Function · 0.45
Example4Function · 0.45

Calls 5

renderMethod · 0.95
isTTYMethod · 0.80
cursorSaveMethod · 0.80
cursorMethod · 0.80
lineWrappingMethod · 0.80

Tested by

no test coverage detected