@vexify-org/yaggs 6.6.0 → 6.7.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
@@ -152,6 +152,11 @@ class Yaggs {
152
152
  return this;
153
153
  }
154
154
 
155
+ async countdown(seconds, message = 'Countdown') {
156
+ await this.parser.countdown(seconds, message);
157
+ return this;
158
+ }
159
+
155
160
  check(fn) {
156
161
  this.middleware(fn);
157
162
  return this;
package/lib/parser.js CHANGED
@@ -863,6 +863,24 @@ complete -c ${this.scriptName} `;
863
863
  this.log(message, 'success');
864
864
  }
865
865
 
866
+ countdown(seconds, message = 'Countdown') {
867
+ let remaining = seconds;
868
+
869
+ return new Promise((resolve) => {
870
+ const timer = setInterval(() => {
871
+ process.stdout.write(`\r\u001b[33m${message}: ${remaining} seconds remaining...\u001b[0m`);
872
+
873
+ remaining--;
874
+
875
+ if (remaining <= 0) {
876
+ clearInterval(timer);
877
+ process.stdout.write('\n');
878
+ resolve();
879
+ }
880
+ }, 1000);
881
+ });
882
+ }
883
+
866
884
  getHelp() {
867
885
  let help = `\u001b[36m${this.scriptName}\u001b[0m`;
868
886
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexify-org/yaggs",
3
- "version": "6.6.0",
3
+ "version": "6.7.0",
4
4
  "description": "A powerful CLI argument parser, better than yargs",
5
5
  "main": "index.js",
6
6
  "scripts": {