CQL.js
function(callback){
    var filePath;

    output("Processing arguments...");

    if(program.cql){
        batchQueries.push(program.cql.toString().trim());
    }

    if((!program.keyspace || program.keyspace.length === 0)){
        output("A keyspace has not been defined. CQL will fail if the keyspace is not defined in the statement.");
    }

    if((!program.files || program.files.length === 0) && (!program.cql || program.cql.length === 0)){
        return callback("Need a file to load or cql to run. Use -f=filename or --files=filename,filename or -cql='someCQLStatement;' or --cql='someCQLStatement;'. Run node CQL --help for mode information.", false);
    }else if(process.env.NODE_ENV === 'production' && !program.production){
        return callback("CQL cannot be run while the NODE_ENV is set to production.", false);
    }else if(program.production && process.env.NODE_ENV === 'production'){
        output("***** Preparing to run scripts in production mode *****");
        output("***** You have " + productionRunDelay + " seconds to think about what your doing before the scripts will execute. *****");
        output("***** CTRL+C to Exit *****");

        barTimer = setInterval(function () {
            bar.tick();
            if (bar.complete) {
                output("***** OK! Here we go... *****");
                output("***** Running scripts in production mode *****");
                clearInterval(barTimer);
                return callback(null, true);
            }
        }, 1000);

        return;

    }else if(program.production && process.env.NODE_ENV !== 'production'){
        return callback("NODE_ENV is set not set to production, but you attempted to run in production mode.", false);
    }

    callback(null, true);
}
function(callback){
    var filePath;

    output("Processing arguments...");

    if(program.cql){
        batchQueries.push(program.cql.toString().trim());
    }

    if((!program.keyspace || program.keyspace.length === 0)){
        output("A keyspace has not been defined. CQL will fail if the keyspace is not defined in the statement.");
    }

    if((!program.files || program.files.length === 0) && (!program.cql || program.cql.length === 0)){
        return callback("Need a file to load or cql to run. Use -f=filename or --files=filename,filename or -cql='someCQLStatement;' or --cql='someCQLStatement;'. Run node CQL --help for mode information.", false);
    }else if(process.env.NODE_ENV === 'production' && !program.production){
        return callback("CQL cannot be run while the NODE_ENV is set to production.", false);
    }else if(program.production && process.env.NODE_ENV === 'production'){
        output("***** Preparing to run scripts in production mode *****");
        output("***** You have " + productionRunDelay + " seconds to think about what your doing before the scripts will execute. *****");
        output("***** CTRL+C to Exit *****");

        barTimer = setInterval(function () {
            bar.tick();
            if (bar.complete) {
                output("***** OK! Here we go... *****");
                output("***** Running scripts in production mode *****");
                clearInterval(barTimer);
                return callback(null, true);
            }
        }, 1000);

        return;

    }else if(program.production && process.env.NODE_ENV !== 'production'){
        return callback("NODE_ENV is set not set to production, but you attempted to run in production mode.", false);
    }

    callback(null, true);
}
function ( callback ) { var filePath ; output ( "Processing arguments..." ) ; if ( program . cql ) { batchQueries . push ( program . cql . toString ( ) . trim ( ) ) ; } if ( ( ! program . keyspace || program . keyspace . length === 0 ) ) { output ( "A keyspace has not been defined. CQL will fail if the keyspace is not defined in the statement." ) ; } if ( ( ! program . files || program . files . length === 0 ) && ( ! program . cql || program . cql . length === 0 ) ) { return callback ( "Need a file to load or cql to run. Use -f=filename or --files=filename,filename or -cql='someCQLStatement;' or --cql='someCQLStatement;'. Run node CQL --help for mode information." , false ) ; } else if ( process . env . NODE_ENV === 'production' && ! program . production ) { return callback ( "CQL cannot be run while the NODE_ENV is set to production." , false ) ; } else if ( program . production && process . env . NODE_ENV === 'production' ) { output ( "***** Preparing to run scripts in production mode *****" ) ; output ( "***** You have " + productionRunDelay + " seconds to think about what your doing before the scripts will execute. *****" ) ; output ( "***** CTRL+C to Exit *****" ) ; barTimer = setInterval ( function ( ) { bar . tick ( ) ; if ( bar . complete ) { output ( "***** OK! Here we go... *****" ) ; output ( "***** Running scripts in production mode *****" ) ; clearInterval ( barTimer ) ; return callback ( null , true ) ; } } , 1000 ) ; return ; } else if ( program . production && process . env . NODE_ENV !== 'production' ) { return callback ( "NODE_ENV is set not set to production, but you attempted to run in production mode." , false ) ; } callback ( null , true ) ; }
Verifies the arguments are valid and ant require arguments are handled.
@param  {Function} callback Callback to async with error or success
Verifies the arguments are valid and ant require arguments are handled .