1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-10 15:57:07 +01:00

Support --assert option for validate command.

Cause HMR to return an error code if validation fails and the --assert
option is present.
This commit is contained in:
hacksalot
2016-01-06 00:44:34 -05:00
parent f61deda4e8
commit 2d20077c08
4 changed files with 17 additions and 5 deletions

View File

@ -10,6 +10,7 @@ Implementation of the 'validate' verb for HackMyResume.
var ResumeFactory = require('../core/resume-factory');
var SyntaxErrorEx = require('../utils/syntax-error-ex');
var chalk = require('chalk');
var HACKMYSTATUS = require('../core/status-codes');
module.exports =
@ -55,6 +56,7 @@ Implementation of the 'validate' verb for HackMyResume.
else {
_log(chalk.red.bold('ERROR: ' + ex.toString()));
}
if( opts.assert ) throw { fluenterror: HACKMYSTATUS.invalid };
return;
}
@ -92,6 +94,10 @@ Implementation of the 'validate' verb for HackMyResume.
err.message) );
});
if( opts.assert && !isValid ) {
throw { fluenterror: HACKMYSTATUS.invalid, shouldExit: true };
}
});
};