@vexify-org/yaggs 6.3.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -117,6 +117,11 @@ class Yaggs {
117
117
  return this.parser.prompt(questions);
118
118
  }
119
119
 
120
+ progress(percentage, message = '') {
121
+ this.parser.progress(percentage, message);
122
+ return this;
123
+ }
124
+
120
125
  check(fn) {
121
126
  this.middleware(fn);
122
127
  return this;
package/lib/parser.js CHANGED
@@ -771,6 +771,21 @@ complete -c ${this.scriptName} `;
771
771
  return answers;
772
772
  }
773
773
 
774
+ progress(percentage, message = '') {
775
+ const barLength = 40;
776
+ const filled = Math.round(barLength * percentage / 100);
777
+ const empty = barLength - filled;
778
+
779
+ const bar = '\u001b[32m' + '█'.repeat(filled) + '\u001b[0m' + '░'.repeat(empty);
780
+ const percent = percentage.toFixed(1);
781
+
782
+ process.stdout.write(`\r${bar} ${percent}% ${message}`);
783
+
784
+ if (percentage >= 100) {
785
+ process.stdout.write('\n');
786
+ }
787
+ }
788
+
774
789
  getHelp() {
775
790
  let help = `\u001b[36m${this.scriptName}\u001b[0m`;
776
791
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexify-org/yaggs",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "A powerful CLI argument parser, better than yargs",
5
5
  "main": "index.js",
6
6
  "scripts": {