src/index.js
function main() {
  var parser = nomnom();
  parser.script('ijs')
        .nocolors()
        .printer(function(s, code) {
          console.log(s);
          if (code) {
            process.exit(code);
          }
        })
        .option('version', {
          abbr: 'v',
          flag: true,
          help: 'print version and exit',
          callback: function() {
            console.log('0.1.0');
            process.exit(0);
          }
        })
        .option('userPath', {
          abbr: 'u',
          full: 'userPath',
          metavar: 'path',
          type: 'string',
          required: true,
          help: 'path that will contain installed node modules',
          callback: function(userPath) {
            if (!fs.existsSync(userPath) || !fs.statSync(userPath).isDirectory()) {
              return 'expected an existing directory for the userPath option';
            }
            return null;
          }
        })
        .option('connectionFile', {
          position: 0,
          required: true,
          help: 'path to file containing kernel connection information'
        });
  var options = parser.parse(process.argv.slice(2));

  if (options) {
    var shellConfig = {
      userPath: options.userPath
    };

    var connectionConfig = JSON.parse(fs.readFileSync(options.connectionFile,
                                                      { encoding: 'utf8' }));

    Shell.create(shellConfig, function(shell) {
      Session.run(shell, connectionConfig);
    });
  }
}
function main() {
  var parser = nomnom();
  parser.script('ijs')
        .nocolors()
        .printer(function(s, code) {
          console.log(s);
          if (code) {
            process.exit(code);
          }
        })
        .option('version', {
          abbr: 'v',
          flag: true,
          help: 'print version and exit',
          callback: function() {
            console.log('0.1.0');
            process.exit(0);
          }
        })
        .option('userPath', {
          abbr: 'u',
          full: 'userPath',
          metavar: 'path',
          type: 'string',
          required: true,
          help: 'path that will contain installed node modules',
          callback: function(userPath) {
            if (!fs.existsSync(userPath) || !fs.statSync(userPath).isDirectory()) {
              return 'expected an existing directory for the userPath option';
            }
            return null;
          }
        })
        .option('connectionFile', {
          position: 0,
          required: true,
          help: 'path to file containing kernel connection information'
        });
  var options = parser.parse(process.argv.slice(2));

  if (options) {
    var shellConfig = {
      userPath: options.userPath
    };

    var connectionConfig = JSON.parse(fs.readFileSync(options.connectionFile,
                                                      { encoding: 'utf8' }));

    Shell.create(shellConfig, function(shell) {
      Session.run(shell, connectionConfig);
    });
  }
}
The main method which parses input arguments, creates a Shell providing evaluation functionality and the Session object to handle the kernel protocol.