Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

vipera-npm-registry / de-doc-generator   js

Repository URL to install this package:

Version: 1.0.0 

/ bin / cli / CliExecutor.js

/**
 * Created by marcobonati on 15/05/2017.
 */

"use strict";

var nopt = require("nopt")
var path = require('path');
var pjson = require('../../package.json');
var colors = require('colors');
var help = require('./help')
var DocGenerator = require('./DocGenerator');

/**
 *
 * @constructor
 */
function CliExecutor(){

}

CliExecutor.prototype.runCli = function(inputArgs) {

    var args = nopt(knownOpts, shortHands, inputArgs);

    if (args.help) {
        return help(args);
    }

    /**
    if (args.platformlist) {
        var cordovaPrj = new CordovaProject();
        cordovaPrj.loadFromPath(process.cwd());
        console.log(cordovaPrj.listInstalledPlatforms());
        return;
    }

    if (args.buildAssetsBundle) {
        var assetsBuilder = new AssetsBuilder();
        assetsBuilder.runCli(args,() => {
            console.log("buildAssetsBundle complete");
        });
        return;
    }

    if (args.buildAssets) {
        var assetsBuilder = new AssetsBuilder();
        assetsBuilder.runCli(args,() => {
            console.log("assetsBuilder complete");
        });
        return;
    }
     **/

    /**
    if (args.config){
        console.log("Config=" + args.config);
    }

    if (args.out){
        console.log("Out=" + args.out);
    }
     **/

    var docGenerator = new DocGenerator();
    docGenerator.runCli(args, ()=>{
        console.log("Documentation generation completed.");
    });

}

CliExecutor.prototype.displayVersion = function() {
    console.log('DE Cli version ' +colors.green('' + pjson.version + '') +" "+  'Codename ' + pjson.codename);
}

CliExecutor.prototype.displayHelp = function(){
    console.log(colors.green('DE Cli Help'));
    console.log('TODO!!');
}



var knownOpts = {
    'version' : String
    ,'help' : Boolean
    ,'config' : String
    ,'out' : String
};

var shortHands = {
    'v' : '--version'
    ,'?' : '--help'
    ,'h' : '--help'
    ,'c' : '--config'
    ,'o' : '--output'
};



// export the class
module.exports = CliExecutor;