'use strict';
exports.__esModule = true;
var batch_1 = require("./batch");
var request = require("request");
var log = require("./log");
var pjson = require("pjson");
var current_version = pjson.version;
/* Check if the current version is the latest */
log.info('Crunchy version ' + current_version);
request.get({ uri: 'https://raw.githubusercontent.com/Godzil/Crunchy/master/package.json' }, function (error, response, body) {
    var onlinepkg = JSON.parse(body);
    var tmp = current_version.split('.');
    var cur = (Number(tmp[0]) * 10000) + (Number(tmp[1]) * 100) + Number(tmp[2]);
    tmp = onlinepkg.version.split('.');
    var dist = (Number(tmp[0]) * 10000) + (Number(tmp[1]) * 100) + Number(tmp[2]);
    if (dist > cur) {
        log.warn('There is a newer version of crunchy (v' + onlinepkg.version + '), you should update!');
    }
});
batch_1["default"](process.argv, function (err) {
    if (err) {
        if (err.stack) {
            console.error(err.stack || err);
        }
        else {
            console.error(err);
        }
        process.exit(-1);
    }
    console.info('Done!');
    process.exit(0);
});
//# sourceMappingURL=cli.js.map