#!/usr/bin/env node

var parser = require("swagger-parser");
var request = require("request");
var slugify = require("slugify");
var qs = require("qs");
var async = require("async");
var program = require("commander");

program
  .version("0.0.1")
  .description("3scale command line tool")
  .usage("[options] <file ...>")
  .option("-f, --file <path>', 'Specify path to a Swagger file")
  .parse(process.argv);

if (program.file){
  importSwagger(program.file);
}else{
  console.log("Specify the path of a swagger spec with -f")
};

var importSwagger = function(path){
  parser.parse(path, function(err, api, metadata) {
    if(err)
      console.log(err);

    if(api)
      console.log(api.info.title);
  });
};
