How to use the ssh-config.length function in ssh-config

To help you get started, we’ve selected a few ssh-config 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 derimagia / sshconfig2iterm / cli.js View on Github external
fs.readFile(process.env.HOME + '/.ssh/config', function (err, data) {
  if (err) {
    throw err;
  }

  sshConfig = sshConfig.parse(data.toString());

  var output = {
    Profiles: [],
  };

  for (var i = 0, len = sshConfig.length; i < len; i++) {
    var section = sshConfig[i];

    var host = section.Host;

    var comment = null;
    var commentIndex = section.Host.indexOf('#');

    if (commentIndex !== -1) {
      host = section.Host.substr(0, commentIndex);
      comment = section.Host.substr(commentIndex + 1).trim();
    }
    var host = host.trim();

    // Skip Wildcard Entries
    if (host.indexOf('*') != -1) continue;

ssh-config

SSH config parser and stringifier

MIT
Latest version published 3 months ago

Package Health Score

69 / 100
Full package analysis