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

CONVERT: Improve command consistency.

This commit is contained in:
hacksalot
2018-01-30 02:34:58 -05:00
parent 6b125ed907
commit c913de4bf7
19 changed files with 208 additions and 50 deletions

View File

@ -248,6 +248,11 @@ assembleError = ( ex ) ->
msg = M2C( @msgs.optionsFileNotFound.msg )
etype = 'error'
when HMSTATUS.unknownSchema
msg = M2C( @msgs.unknownSchema.msg[0] )
#msg += "\n" + M2C( @msgs.unknownSchema.msg[1], 'yellow' )
etype = 'error'
msg: msg # The error message to display
withStack: withStack # Whether to include the stack
quit: quit

View File

@ -262,7 +262,7 @@ execute = ( src, dst, opts, log ) ->
v = new HMR.verbs[ @name() ]()
# Initialize command-specific options
loadOptions.call( this, opts, this.parent.jsonArgs )
loadOptions.call this, opts, this.parent.jsonArgs
# Set up error/output handling
_opts.errHandler = v
@ -288,9 +288,15 @@ executeSuccess = (obj) ->
### Failure handler for verb invocations. Calls process.exit by default ###
executeFail = (err) ->
console.dir err
finalErrorCode = -1
if err
finalErrorCode = if err.fluenterror then err.fluenterror else err
if err.fluenterror
finalErrorCode = err.fluenterror
else if err.length
finalErrorCode = err[0].fluenterror
else
finalErrorCode = err
if _opts.debug
msgs = require('./msg').errors;
logMsg printf M2C( msgs.exiting.msg, 'cyan' ), finalErrorCode

View File

@ -115,3 +115,20 @@ errors:
- "\nMake sure the options file contains valid JSON."
optionsFileNotFound:
msg: "The specified options file is missing or inaccessible."
unknownSchema:
msg:
- "Unknown resume schema. Did you specify a valid FRESH or JRS resume?"
- |
At a minimum, a FRESH resume must include a "name" field and a "meta"
property.
"name": "John Doe",
"meta": {
"format": "FRESH@0.1.0"
}
JRS-format resumes must include a "basics" section with a "name":
"basics": {
"name": "John Doe"
}

View File

@ -131,7 +131,7 @@ module.exports = class OutputHandler
@log( chalk.cyan(output) )
when HME.beforeConvert
L( M2C( this.msgs.beforeConvert.msg, 'green' ),
L( M2C( this.msgs.beforeConvert.msg, if evt.error then 'red' else 'green' ),
evt.srcFile, evt.srcFmt, evt.dstFile, evt.dstFmt
);