How to use @boost/terminal - 10 common examples

To help you get started, we’ve selected a few @boost/terminal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github milesj / boost / packages / core / src / Output.ts View on Github external
// Mark first render
    if (this.state.first) {
      this.state.first = false;
      this.onFirst();
    }

    let content = this.toString(this.renderer());

    // Always end with a new line
    if (!content.endsWith('\n')) {
      content += '\n';
    }

    // Content cannot be higher than the terminal
    const lines = content.split('\n');
    const maxHeight = screen.size().rows - 1; // Buffer for input line

    if (lines.length >= maxHeight) {
      content = lines.slice(-maxHeight).join('\n');
    }

    // Write output
    this.console.out(content);

    // Mark output as complete if the final render
    if (this.isFinal()) {
      this.markComplete();

      // Otherwise calculate the height of the output
    } else {
      this.previousHeight = lines.length;
    }
github milesj / boost / packages / core / src / Console.ts View on Github external
this.emit('error', [error]);
      this.onError.emit([error]);
    } else {
      if (this.logs.length > 0) {
        this.out(`\n${this.logs.join('\n')}\n`);
      }

      this.displayFooter();
    }

    // Flush any stream output that still exists
    this.flushBufferedStreams();

    // Show the cursor incase it has been hidden
    this.out(cursor.show);
  }
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
output += style.gray('/\\_/\\');
    output += '\n';

    // Face
    output += this.rainbows[2].join('');
    output += ' ';

    if (tick) {
      output += style.gray('~');
      output += style.magenta('|_');
    } else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';

    // Feet
    output += this.rainbows[3].join('');
    output += ' ';

    if (tick) {
      output += style.gray(' "  ""  "');
    } else {
      output += style.gray('  ""  ""');
    }

    output += '\n';

    if (this.isFinalRender()) {
      return output;
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
output += style.gray('~');
      output += style.magenta('|_');
    } else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';

    // Feet
    output += this.rainbows[3].join('');
    output += ' ';

    if (tick) {
      output += style.gray(' "  ""  "');
    } else {
      output += style.gray('  ""  ""');
    }

    output += '\n';

    if (this.isFinalRender()) {
      return output;
    }

    // Routine
    const routine = this.activeRoutine;
    const task = this.activeTask;
    let line = '\n';

    if (routine) {
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
this.increaseRainbowWidth();

    const tick = this.isInterval();
    let output = '\n';

    // Poptart
    output += this.rainbows[0].join('');
    output += ' ';
    output += style.magenta(' ,------,');
    output += '\n';

    // Ears
    output += this.rainbows[1].join('');
    output += ' ';
    output += style.magenta(` |${tick ? ' .' : ' . '}`);
    output += style.gray('/\\_/\\');
    output += '\n';

    // Face
    output += this.rainbows[2].join('');
    output += ' ';

    if (tick) {
      output += style.gray('~');
      output += style.magenta('|_');
    } else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
// Ears
    output += this.rainbows[1].join('');
    output += ' ';
    output += style.magenta(` |${tick ? ' .' : ' . '}`);
    output += style.gray('/\\_/\\');
    output += '\n';

    // Face
    output += this.rainbows[2].join('');
    output += ' ';

    if (tick) {
      output += style.gray('~');
      output += style.magenta('|_');
    } else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';

    // Feet
    output += this.rainbows[3].join('');
    output += ' ';

    if (tick) {
      output += style.gray(' "  ""  "');
    } else {
      output += style.gray('  ""  ""');
    }
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
} else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';

    // Feet
    output += this.rainbows[3].join('');
    output += ' ';

    if (tick) {
      output += style.gray(' "  ""  "');
    } else {
      output += style.gray('  ""  ""');
    }

    output += '\n';

    if (this.isFinalRender()) {
      return output;
    }

    // Routine
    const routine = this.activeRoutine;
    const task = this.activeTask;
    let line = '\n';

    if (routine) {
      line += this.style(routine.key.toUpperCase(), this.getColorType(routine), ['bold']);
      line += ' ';
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
output += style.magenta(' ,------,');
    output += '\n';

    // Ears
    output += this.rainbows[1].join('');
    output += ' ';
    output += style.magenta(` |${tick ? ' .' : ' . '}`);
    output += style.gray('/\\_/\\');
    output += '\n';

    // Face
    output += this.rainbows[2].join('');
    output += ' ';

    if (tick) {
      output += style.gray('~');
      output += style.magenta('|_');
    } else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';

    // Feet
    output += this.rainbows[3].join('');
    output += ' ';

    if (tick) {
      output += style.gray(' "  ""  "');
    } else {
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
output += this.rainbows[1].join('');
    output += ' ';
    output += style.magenta(` |${tick ? ' .' : ' . '}`);
    output += style.gray('/\\_/\\');
    output += '\n';

    // Face
    output += this.rainbows[2].join('');
    output += ' ';

    if (tick) {
      output += style.gray('~');
      output += style.magenta('|_');
    } else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';

    // Feet
    output += this.rainbows[3].join('');
    output += ' ';

    if (tick) {
      output += style.gray(' "  ""  "');
    } else {
      output += style.gray('  ""  ""');
    }

    output += '\n';
github milesj / boost / packages / reporter-nyan / src / NyanReporter.ts View on Github external
output += '\n';

    // Ears
    output += this.rainbows[1].join('');
    output += ' ';
    output += style.magenta(` |${tick ? ' .' : ' . '}`);
    output += style.gray('/\\_/\\');
    output += '\n';

    // Face
    output += this.rainbows[2].join('');
    output += ' ';

    if (tick) {
      output += style.gray('~');
      output += style.magenta('|_');
    } else {
      output += style.gray('^');
      output += style.magenta('|__');
    }

    output += style.gray(this.getCatFace());
    output += '\n';

    // Feet
    output += this.rainbows[3].join('');
    output += ' ';

    if (tick) {
      output += style.gray(' "  ""  "');
    } else {
      output += style.gray('  ""  ""');