1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-15 10:07: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:
hacksalot
2016-01-15 13:08:01 -05:00
parent de5c2ecb95
commit 4c5ccc001a
7 changed files with 125 additions and 10 deletions

View File

@ -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
}
}
}