mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
Remove unnecessary indirection.
This commit is contained in:
parent
69e8adc1cc
commit
8fc0fa99d3
20
src/index.js
20
src/index.js
@ -38,12 +38,6 @@ function main() {
|
|||||||
|
|
||||||
var args = initialize();
|
var args = initialize();
|
||||||
|
|
||||||
function execCommand() {
|
|
||||||
var argsArray = Array.prototype.slice.call(arguments);
|
|
||||||
//console.log(argsArray);
|
|
||||||
return FCMD.verbs[ this.name() ].apply( null, argsArray );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the top-level (application) command...
|
// Create the top-level (application) command...
|
||||||
var program = new Command('hackmyresume')
|
var program = new Command('hackmyresume')
|
||||||
.version(PKG.version)
|
.version(PKG.version)
|
||||||
@ -59,7 +53,7 @@ function main() {
|
|||||||
.alias('create')
|
.alias('create')
|
||||||
.description('Create resume(s) in FRESH or JSON RESUME format.')
|
.description('Create resume(s) in FRESH or JSON RESUME format.')
|
||||||
.action(function( sources ) {
|
.action(function( sources ) {
|
||||||
execCommand.call( this, sources, [], this.opts(), logMsg );
|
FCMD.verbs[ this.name() ].call( null, sources, [], this.opts(), logMsg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create the VALIDATE command
|
// Create the VALIDATE command
|
||||||
@ -68,7 +62,7 @@ function main() {
|
|||||||
.arguments('<sources...>')
|
.arguments('<sources...>')
|
||||||
.description('Validate a resume in FRESH or JSON RESUME format.')
|
.description('Validate a resume in FRESH or JSON RESUME format.')
|
||||||
.action(function(sources) {
|
.action(function(sources) {
|
||||||
execCommand.call(this, sources, [], this.opts(), logMsg);
|
FCMD.verbs[ this.name() ].call( null, sources, [], this.opts(), logMsg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create the CONVERT command
|
// Create the CONVERT command
|
||||||
@ -78,7 +72,7 @@ function main() {
|
|||||||
.description('Convert a resume to/from FRESH or JSON RESUME format.')
|
.description('Convert a resume to/from FRESH or JSON RESUME format.')
|
||||||
.action(function() {
|
.action(function() {
|
||||||
var x = splitSrcDest.call( this );
|
var x = splitSrcDest.call( this );
|
||||||
execCommand.call( this, x.src, x.dst, this.opts(), logMsg );
|
FCMD.verbs[ this.name() ].call( null, x.src, x.dst, this.opts(), logMsg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create the ANALYZE command
|
// Create the ANALYZE command
|
||||||
@ -86,8 +80,8 @@ function main() {
|
|||||||
.command('analyze')
|
.command('analyze')
|
||||||
.arguments('<sources...>')
|
.arguments('<sources...>')
|
||||||
.description('Analyze one or more resumes.')
|
.description('Analyze one or more resumes.')
|
||||||
.action(function() {
|
.action(function( sources ) {
|
||||||
execCommand.call(this, sources, [], this.opts(), logMsg);
|
FCMD.verbs[ this.name() ].call( null, sources, [], this.opts(), logMsg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create the BUILD command
|
// Create the BUILD command
|
||||||
@ -101,7 +95,7 @@ function main() {
|
|||||||
.description('Generate resume to multiple formats')
|
.description('Generate resume to multiple formats')
|
||||||
.action(function( sources, targets, options ) {
|
.action(function( sources, targets, options ) {
|
||||||
var x = splitSrcDest.call( this );
|
var x = splitSrcDest.call( this );
|
||||||
execCommand.call( this, x.src, x.dst, opts, logMsg );
|
FCMD.verbs[ this.name() ].call( null, x.src, x.dst, this.opts(), logMsg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// program.on('--help', function(){
|
// program.on('--help', function(){
|
||||||
@ -167,7 +161,7 @@ function initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle invalid verbs here (a bit easier here than in commander.js)...
|
// Handle invalid verbs here (a bit easier here than in commander.js)...
|
||||||
if( !FCMD.verbs[ verb ] && !FCMD.alias[ verb ] ) {
|
if( verb && !FCMD.verbs[ verb ] && !FCMD.alias[ verb ] ) {
|
||||||
throw { fluenterror: HACKMYSTATUS.invalidCommand, shouldExit: true,
|
throw { fluenterror: HACKMYSTATUS.invalidCommand, shouldExit: true,
|
||||||
attempted: oVerb };
|
attempted: oVerb };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user