mirror of
				https://github.com/JuanCanham/HackMyResume.git
				synced 2025-10-31 05:07:26 +00:00 
			
		
		
		
	CONVERT: Improve command consistency.
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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" | ||||
|           } | ||||
|   | ||||
| @@ -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 | ||||
|         ); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user