fluxy-bot 0.5.59 → 0.5.60

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.
Files changed (2) hide show
  1. package/bin/cli.js +15 -9
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -167,16 +167,22 @@ function chooseTunnelMode() {
167
167
  ];
168
168
 
169
169
  let selected = 0;
170
+ let lineCount = 0;
171
+
172
+ function writeLine(text = '') {
173
+ process.stdout.write(`\x1b[2K${text}\n`);
174
+ lineCount++;
175
+ }
170
176
 
171
177
  function render() {
172
- // Move cursor up to clear previous render (skip on first render)
173
- const totalLines = options.reduce((sum, o) => sum + 2 + o.desc.length, 0) + 2;
174
- if (render._rendered) {
175
- process.stdout.write(`\x1b[${totalLines}A`);
178
+ // Move cursor up to overwrite previous render
179
+ if (lineCount > 0) {
180
+ process.stdout.write(`\x1b[${lineCount}A`);
176
181
  }
177
- render._rendered = true;
182
+ lineCount = 0;
178
183
 
179
- console.log(` ${c.bold}${c.white}How do you want to connect your bot?${c.reset}\n`);
184
+ writeLine(` ${c.bold}${c.white}How do you want to connect your bot?${c.reset}`);
185
+ writeLine();
180
186
 
181
187
  for (let i = 0; i < options.length; i++) {
182
188
  const opt = options[i];
@@ -185,11 +191,11 @@ function chooseTunnelMode() {
185
191
  const label = isSelected ? `${c.bold}${c.white}${opt.label}` : `${c.dim}${opt.label}`;
186
192
  const tag = `${opt.tagColor}[${opt.tag}]${c.reset}`;
187
193
 
188
- console.log(` ${bullet} ${label}${c.reset} ${tag}`);
194
+ writeLine(` ${bullet} ${label}${c.reset} ${tag}`);
189
195
  for (const line of opt.desc) {
190
- console.log(` ${c.dim}${line}${c.reset}`);
196
+ writeLine(` ${c.dim}${line}${c.reset}`);
191
197
  }
192
- if (i < options.length - 1) console.log('');
198
+ if (i < options.length - 1) writeLine();
193
199
  }
194
200
  }
195
201
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.5.59",
3
+ "version": "0.5.60",
4
4
  "releaseNotes": [
5
5
  "Fixed some bugs to iOs ",
6
6
  "2. ",