diff --git a/src/index.js b/src/index.js index d8a2ee5..3de0db6 100644 --- a/src/index.js +++ b/src/index.js @@ -10,236 +10,15 @@ Command-line interface (CLI) for HackMyResume. -var SPAWNW = require('./core/spawn-watch') - , HMR = require( './hackmyapi') - , PKG = require('../package.json') - , FS = require('fs') - , EXTEND = require('./utils/extend') - , chalk = require('chalk') - , PATH = require('path') - , HACKMYSTATUS = require('./core/status-codes') - , safeLoadJSON = require('./utils/safe-json-loader') - , _opts = { } - , title = chalk.white.bold('\n*** HackMyResume v' + PKG.version + ' ***') - , StringUtils = require('./utils/string.js') - , _ = require('underscore') - , Command = require('commander').Command; - - try { - main(); + + var main = require('./main'); + main( process.argv ); + } catch( ex ) { + require('./core/error-handler').err( ex, true ); -} - - -/** -Kick off the HackMyResume application. -*/ -function main() { - - var args = initialize(); - - // Create the top-level (application) command... - var program = new Command('hackmyresume') - .version(PKG.version) - .description(chalk.yellow.bold('*** HackMyResume ***')) - .option('-o --opts ', 'Path to a .hackmyrc options file') - .option('-s --silent', 'Run in silent mode') - .option('--no-color', 'Disable colors') - .option('--color', 'Enable colors') - .option('-d --debug', 'Enable diagnostics', false); - //.usage('COMMAND [TO ]'); - - // Create the NEW command - program - .command('new') - .arguments('') - .option('-f --format ', 'FRESH or JRS format', 'FRESH') - .alias('create') - .description('Create resume(s) in FRESH or JSON RESUME format.') - .action(function( sources ) { - execVerb.call( this, sources, [], this.opts(), logMsg); - }); - - // Create the VALIDATE command - program - .command('validate') - .arguments('') - .option('-a --assert', 'Treat validation warnings as errors', false) - .description('Validate a resume in FRESH or JSON RESUME format.') - .action(function(sources) { - execVerb.call( this, sources, [], this.opts(), logMsg); - }); - - // Create the CONVERT command - program - .command('convert') - //.arguments('') - .description('Convert a resume to/from FRESH or JSON RESUME format.') - .action(function() { - var x = splitSrcDest.call( this ); - execVerb.call( this, x.src, x.dst, this.opts(), logMsg); - }); - - // Create the ANALYZE command - program - .command('analyze') - .arguments('') - .description('Analyze one or more resumes.') - .action(function( sources ) { - execVerb.call( this, sources, [], this.opts(), logMsg); - }); - - // Create the BUILD command - program - .command('build') - .alias('generate') - //.arguments(' TO [targets]') - //.usage('...') - .option('-t --theme ', 'Theme name or path') - .option('-n --no-prettify', 'Disable HTML prettification', true) - .option('-c --css