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:
@ -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 };
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user