/*
 * mongo-edu
 *
 * Copyright (c) 2014 Przemyslaw Pluta
 * Licensed under the MIT license.
 * https://github.com/przemyslawpluta/mongo-edu/blob/master/LICENSE
 */

var which = require('which'),
    glob = require('glob');

module.exports = function configure(argv, callback) {

    'use strict';

    var python = argv.py || process.env.PYTHON || 'python',
        isWin = /^win/.test(process.platform);

    function checkPython() {

        which(python, function whichTest(err) {
            if (err !== null) {
                if (isWin) { guessPython(); } else { failNoPython(); }
            } else {
                process.env.PYTHON = python;
                callback(null);
            }
        });
    }

    function guessPython() {

        glob('\\Python**\\python.exe', function find(err, files) {

            if (err !== null) { return callback(err); }

            if (!files.length) { return failNoPython(); }

            python = files.shift();
            process.env.PYTHON = python;
            callback(null);

        });
    }

    function failNoPython() {
        callback(new Error('Can\'t find Python executable "' + python + '", you can set the PYTHON env variable.'));
    }

    checkPython();
};

@@ -189,16 +189,48 @@
 hich'),%0A
+    colors = require('colors'),%0A
     glob
@@ -1126,27 +1126,38 @@
    c
-allback(new Error('
+onsole.log('%5B' + 'i'.red + '%5D 
 Can%5C
@@ -1182,17 +1182,16 @@
 cutable 
-%22
 ' + pyth
@@ -1196,13 +1196,16 @@
 thon
+.red
  + '
-%22
 , yo
@@ -1240,16 +1240,40 @@
 iable.')
+;%0A        process.exit(0
 );%0A    %7D

update py scan