mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-10 07:47:07 +01:00
Introduce PEEK command.
Peek at arbitrary resumes and resume objects paths with "hackmyresume peek <resume> [objectPath]". For ex: hackmyresume PEEK resume.json hackmyresume PEEK resume.json info hackmyresume PEEK resume.json employment[2].keywords hackmyresume PEEK r1.json r2.json r3.json info.brief
This commit is contained in:
@ -16,6 +16,7 @@ Error-handling routines for HackMyResume.
|
||||
, FCMD = require('../hackmyapi')
|
||||
, PATH = require('path')
|
||||
, WRAP = require('word-wrap')
|
||||
, M2C = require('../utils/md2chalk.js')
|
||||
, chalk = require('chalk')
|
||||
, SyntaxErrorEx = require('../utils/syntax-error-ex');
|
||||
require('string.prototype.startswith');
|
||||
@ -182,7 +183,7 @@ Error-handling routines for HackMyResume.
|
||||
' column ' + se.col + '.';
|
||||
}
|
||||
else {
|
||||
msg = formatError( ex.inner.toString() );
|
||||
msg = ex;
|
||||
}
|
||||
warn = false;
|
||||
break;
|
||||
|
@ -22,7 +22,6 @@ Definition of the `main` function.
|
||||
, StringUtils = require('../utils/string.js')
|
||||
, _ = require('underscore')
|
||||
, OUTPUT = require('./out')
|
||||
, SAFELOADJSON = require('../utils/safe-json-loader')
|
||||
, PAD = require('string-padding')
|
||||
, Command = require('commander').Command;
|
||||
|
||||
@ -93,6 +92,15 @@ Definition of the `main` function.
|
||||
execute.call( this, sources, [], this.opts(), logMsg);
|
||||
});
|
||||
|
||||
// Create the PEEK command
|
||||
program
|
||||
.command('peek')
|
||||
.arguments('<sources...>')
|
||||
.description('Peek at a resume field or section')
|
||||
.action(function( sources, sectionOrField ) {
|
||||
execute.call( this, sources, [ sources.pop() ], this.opts(), logMsg);
|
||||
});
|
||||
|
||||
// Create the BUILD command
|
||||
program
|
||||
.command('build')
|
||||
@ -189,7 +197,8 @@ Definition of the `main` function.
|
||||
if( optStr[0] === '{')
|
||||
oJSON = eval('(' + optStr + ')'); // jshint ignore:line
|
||||
else {
|
||||
oJSON = SAFELOADJSON( optStr );
|
||||
oJSON = safeLoadJSON( optStr );
|
||||
// TODO: Error handling
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,6 +189,20 @@ Output routines for HackMyResume.
|
||||
|
||||
break;
|
||||
|
||||
case HME.beforePeek:
|
||||
if( evt.target )
|
||||
L(M2C('Peeking at **%s** in **%s**...', 'cyan'), evt.target, evt.file);
|
||||
else
|
||||
L(M2C('Peeking at **%s**...', 'cyan'), evt.file);
|
||||
break;
|
||||
|
||||
case HME.afterPeek:
|
||||
if( evt.target )
|
||||
console.dir( evt.target, { depth: null, colors: true } );
|
||||
else
|
||||
L(M2C('The specified key **%s** was not found in **%s**.', 'yellow'), evt.requested, evt.file);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user