code: function ngSwaggerGen(options) {
    if (typeof options.swagger != 'string') {
      console.error("Swagger file not specified in the 'swagger' option");
      process.exit(1);
    }
  
    var globalTunnel = require('global-tunnel-ng');
    globalTunnel.initialize();
    
    $RefParser.bundle(options.swagger, { dereference: { circular: false } }).then(
      data => {
        doGenerate(data, options);
      },
      err => {
        console.error(
          `Error reading swagger location ${options.swagger}: ${err}`
        );
      }
    ).catch(function (error) {
      console.error(`Error: ${error}`);
    });
  }
docs: Main generate function