How to use tty - 10 common examples

To help you get started, we’ve selected a few tty 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 sedwards2009 / extraterm / build_scripts / node_modules-darwin-x64 / ptyw.js / lib / pty.js View on Github external
function TTYStream(fd) {
  // Could use: if (!require('tty').ReadStream)
  if (version[0] === 0 && version[1] < 7) {
    return new net.Socket(fd);
  }

  if (version[0] === 0 && version[1] < 12) {
    return new tty.ReadStream(fd);
  }

  return new Socket(fd);
}
github enb / enb / lib / ui / colorize.js View on Github external
var tty = require('tty');
var chalk = require('chalk');

var enabled = process.env.COLOR || (!process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2));

module.exports = new chalk.constructor({ enabled: enabled });
github hapijs / lab / lib / output.js View on Github external
internals.color = function (name, code, forceColor) {

    if ((Tty.isatty(1) && Tty.isatty(2)) || forceColor) {
        var color = '\u001b[' + code + 'm';
        return function (text) { return color + text + '\u001b[0m'; };
    }

    return function (text) { return text; };
};
github nicolaspanel / node-svm / lib / core / config.js View on Github external
function readCachedConfig(cwd) {
    if (cachedConfigs[cwd]) { return cachedConfigs[cwd]; }

    var config = cachedConfigs[cwd] = normalise(rc('nodesvm', defaults, cwd));

    if (!_o.has(config, 'interactive')) {
        config.interactive = (process.bin === 'node-svm' && tty.isatty(1) && !process.env.CI);
    }

    return config;
}
function resetCache () {
github uber / potter / cli / builtin / help / print-help.js View on Github external
function setRaw(mode) {
    return process.stdin.setRawMode ?
        process.stdin.setRawMode(mode) : tty.setRawMode(mode);
}
github sidorares / ansi-vnc / index.js View on Github external
function setRawMode(val) {
  if (process.stdin.setRawMode)
    process.stdin.setRawMode(val);
  else
    require('tty').setRawMode(val);
}
github carlos8f / node-cli-prompt / index.js View on Github external
function setRawMode(mode) {
    if (process.stdin.setRawMode) {
      process.stdin.setRawMode(mode);
    }
    else if (process.stderr.isTTY) {
      tty.setRawMode(mode);
    }
  }
  if (hideInput) setRawMode(true);
github microsoft / napajs / lib / core / process.js View on Github external
function createWritableStdioStream(fd) {
    var tty = require('tty');
    var stream = new tty.WriteStream(fd);
    stream._type = 'tty';

    if (stream._handle && stream._handle.unref) {
        stream._handle.unref();
    }

    stream.fd = fd;
    stream._isStdio = true;

    return stream;
}
github nodyn / nodyn / src / main / javascript / node.js View on Github external
get: function() {
      if (!this._stdout) {
        if ( this.terminal ) {
          this._stdout = new tty.WriteStream( this.terminal );
        } else {
          this._stdout = new streams.OutputStream( System.out );
        }
        this._stdout._start();
      }
      return this._stdout;
    }
  });
github apiaryio / api-elements.js / packages / fury-cli / lib / fury.js View on Github external
write(output, json = false) {
    if (this.outputPath) {
      fs.writeFileSync(this.outputPath, output);
    } else if (isatty(process.stdout.fd) && json) {
      const highlighted = highlight(output, { json: true, theme });
      process.stdout.write(highlighted);
    } else {
      process.stdout.write(output);
    }
  }
}

tty

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

53 / 100
Full package analysis