1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-23 00:40:10 +00:00

Add formal support for aliases.

new/create and build/generate
This commit is contained in:
hacksalot 2015-12-30 13:00:30 -05:00
parent e3cb949992
commit 1bcc2f7d0c
2 changed files with 14 additions and 10 deletions

View File

@ -22,15 +22,19 @@ Internal resume generation logic for HackMyResume.
/** /**
Internal module interface. Used by FCV Desktop and HMR. Internal module interface. Used by FCV Desktop and HMR.
*/ */
var v = {
build: require('./verbs/generate'),
validate: require('./verbs/validate'),
convert: require('./verbs/convert'),
new: require('./verbs/create'),
help: help
}
return { return {
verbs: { verbs: v,
generate: require('./verbs/generate'), alias: {
build: require('./verbs/generate'), generate: v.build,
validate: require('./verbs/validate'), create: v.build
convert: require('./verbs/convert'),
create: require('./verbs/create'),
new: require('./verbs/create'),
help: help
}, },
lib: require('./hackmyapi'), lib: require('./hackmyapi'),
options: require('./core/default-options'), options: require('./core/default-options'),

View File

@ -55,7 +55,7 @@ function main() {
// Get the action to be performed // Get the action to be performed
var params = a._.map( function(p){ return p.toLowerCase().trim(); }); var params = a._.map( function(p){ return p.toLowerCase().trim(); });
var verb = params[0]; var verb = params[0];
if( !FCMD.verbs[ verb ] ) { if( !FCMD.verbs[ verb ] && !FCMD.alias[ verb ] ) {
logMsg('Invalid command: "'.warn + verb.warn.bold + '"'.warn); logMsg('Invalid command: "'.warn + verb.warn.bold + '"'.warn);
return; return;
} }
@ -76,7 +76,7 @@ function main() {
( splitAt === -1 ) && src.length > 1 && dst.push( src.pop() ); // Allow omitting TO keyword ( splitAt === -1 ) && src.length > 1 && dst.push( src.pop() ); // Allow omitting TO keyword
// Invoke the action // Invoke the action
FCMD.verbs[ verb ].apply( null, [ src, dst, opts, logMsg ] ); (FCMD.verbs[verb] || FCMD.alias[verb]).apply(null, [src, dst, opts, logMsg]);
} }