#! /usr/bin/env node /** Command-line interface (CLI) for HackMyResume. @license MIT. Copyright (c) 2015 hacksalot (https://github.com/hacksalot) @module index.js */ var SPAWNW = require('./core/spawn-watch') , FCMD = require( './hackmycmd') , PKG = require('../package.json') , FS = require('fs') , chalk = require('chalk') , PATH = require('path') , HACKMYSTATUS = require('./core/status-codes') , _opts = { } , title = chalk.white.bold('\n*** HackMyResume v' + PKG.version + ' ***') , StringUtils = require('./utils/string.js') , _ = require('underscore') , Command = require('commander').Command; try { main(); } catch( ex ) { require('./core/error-handler').err( ex, true ); } /** Kick off the HackMyResume application. */ function main() { var args = initialize(); function execVerb( src, dst, opts, log ) { _opts = opts; _opts.silent = this.parent.silent; _opts.opts = this.parent.opts; FCMD.verbs[ this.name() ].call( null, src, dst, opts, log ); } // 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'); //.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('') .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', 'modern') .option('-n --no-prettify', 'Disable HTML prettification', true) .option('-c --css