mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-21 16:00:11 +00:00
style: fix eslint violations
This commit is contained in:
parent
922c1968ca
commit
407f9f8cd7
@ -59,14 +59,14 @@ module.exports = function (grunt) {
|
|||||||
|
|
||||||
// Use 'grunt test' for local testing
|
// Use 'grunt test' for local testing
|
||||||
grunt.registerTask('test', 'Test the HackMyResume application.',
|
grunt.registerTask('test', 'Test the HackMyResume application.',
|
||||||
function( config ) {
|
function() {
|
||||||
grunt.task.run(['clean:test','build','eslint','simplemocha:all']);
|
grunt.task.run(['clean:test','build','eslint','simplemocha:all']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Use 'grunt build' to build HMR
|
// Use 'grunt build' to build HMR
|
||||||
grunt.registerTask('build', 'Build the HackMyResume application.',
|
grunt.registerTask('build', 'Build the HackMyResume application.',
|
||||||
function( config ) {
|
function() {
|
||||||
grunt.task.run( ['clean:dist','copy','coffee','eslint'] );
|
grunt.task.run( ['clean:dist','copy','coffee','eslint'] );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
19
dist/cli/error.js
vendored
19
dist/cli/error.js
vendored
@ -4,18 +4,12 @@
|
|||||||
@module cli/error
|
@module cli/error
|
||||||
@license MIT. See LICENSE.md for details.
|
@license MIT. See LICENSE.md for details.
|
||||||
*/
|
*/
|
||||||
/** Error handler for HackMyResume. All errors are handled here.
|
var FS, HMSTATUS, M2C, PATH, SyntaxErrorEx, WRAP, _defaultLog, assembleError, chalk, extend, printf;
|
||||||
@class ErrorHandler */
|
|
||||||
var ErrorHandler, FCMD, FS, HMSTATUS, M2C, PATH, PKG, SyntaxErrorEx, WRAP, YAML, _defaultLog, assembleError, chalk, extend, printf;
|
|
||||||
|
|
||||||
HMSTATUS = require('../core/status-codes');
|
HMSTATUS = require('../core/status-codes');
|
||||||
|
|
||||||
PKG = require('../../package.json');
|
|
||||||
|
|
||||||
FS = require('fs');
|
FS = require('fs');
|
||||||
|
|
||||||
FCMD = require('../index');
|
|
||||||
|
|
||||||
PATH = require('path');
|
PATH = require('path');
|
||||||
|
|
||||||
WRAP = require('word-wrap');
|
WRAP = require('word-wrap');
|
||||||
@ -26,15 +20,15 @@
|
|||||||
|
|
||||||
extend = require('extend');
|
extend = require('extend');
|
||||||
|
|
||||||
YAML = require('yamljs');
|
|
||||||
|
|
||||||
printf = require('printf');
|
printf = require('printf');
|
||||||
|
|
||||||
SyntaxErrorEx = require('../utils/syntax-error-ex');
|
SyntaxErrorEx = require('../utils/syntax-error-ex');
|
||||||
|
|
||||||
require('string.prototype.startswith');
|
require('string.prototype.startswith');
|
||||||
|
|
||||||
ErrorHandler = module.exports = {
|
/** Error handler for HackMyResume. All errors are handled here.
|
||||||
|
@class ErrorHandler */
|
||||||
|
module.exports = {
|
||||||
init: function(debug, assert, silent) {
|
init: function(debug, assert, silent) {
|
||||||
this.debug = debug;
|
this.debug = debug;
|
||||||
this.assert = assert;
|
this.assert = assert;
|
||||||
@ -94,7 +88,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
_defaultLog = function() {
|
_defaultLog = function() {
|
||||||
return console.log.apply(console.log, arguments);
|
return console.log.apply(console.log, arguments); // eslint-disable-line no-console
|
||||||
};
|
};
|
||||||
|
|
||||||
assembleError = function(ex) {
|
assembleError = function(ex) {
|
||||||
@ -185,6 +179,7 @@
|
|||||||
break;
|
break;
|
||||||
case HMSTATUS.readError:
|
case HMSTATUS.readError:
|
||||||
if (!ex.quiet) {
|
if (!ex.quiet) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
|
console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
|
||||||
}
|
}
|
||||||
msg = ex.inner.toString();
|
msg = ex.inner.toString();
|
||||||
@ -215,6 +210,7 @@
|
|||||||
break;
|
break;
|
||||||
case HMSTATUS.parseError:
|
case HMSTATUS.parseError:
|
||||||
if (SyntaxErrorEx.is(ex.inner)) {
|
if (SyntaxErrorEx.is(ex.inner)) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
|
console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
|
||||||
se = new SyntaxErrorEx(ex, ex.raw);
|
se = new SyntaxErrorEx(ex, ex.raw);
|
||||||
if ((se.line != null) && (se.col != null)) {
|
if ((se.line != null) && (se.col != null)) {
|
||||||
@ -243,6 +239,7 @@
|
|||||||
case HMSTATUS.invalidOptionsFile:
|
case HMSTATUS.invalidOptionsFile:
|
||||||
msg = M2C(this.msgs.invalidOptionsFile.msg[0]);
|
msg = M2C(this.msgs.invalidOptionsFile.msg[0]);
|
||||||
if (SyntaxErrorEx.is(ex.inner)) {
|
if (SyntaxErrorEx.is(ex.inner)) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
|
console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file));
|
||||||
se = new SyntaxErrorEx(ex, ex.raw);
|
se = new SyntaxErrorEx(ex, ex.raw);
|
||||||
if ((se.line != null) && (se.col != null)) {
|
if ((se.line != null) && (se.col != null)) {
|
||||||
|
34
dist/cli/main.js
vendored
34
dist/cli/main.js
vendored
@ -15,15 +15,8 @@
|
|||||||
- Need to accept JSON inputs from the command line.
|
- Need to accept JSON inputs from the command line.
|
||||||
*/
|
*/
|
||||||
/* Simple logging placeholder. */
|
/* Simple logging placeholder. */
|
||||||
/*
|
|
||||||
A callable implementation of the HackMyResume CLI. Encapsulates the command
|
|
||||||
line interface as a single method accepting a parameter array.
|
|
||||||
@alias module:cli/main.main
|
|
||||||
@param rawArgs {Array} An array of command-line parameters. Will either be
|
|
||||||
process.argv (in production) or custom parameters (in test).
|
|
||||||
*/
|
|
||||||
/* Split multiple command-line filenames by the 'TO' keyword */
|
/* Split multiple command-line filenames by the 'TO' keyword */
|
||||||
var Command, EXTEND, FS, HME, HMR, HMSTATUS, M2C, OUTPUT, PAD, PATH, PKG, StringUtils, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, executeFail, executeSuccess, initOptions, initialize, loadOptions, logMsg, main, printf, safeLoadJSON, splitSrcDest;
|
var Command, EXTEND, FS, HMR, HMSTATUS, M2C, OUTPUT, PAD, PATH, PKG, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, executeFail, executeSuccess, initOptions, initialize, loadOptions, logMsg, printf, safeLoadJSON, splitSrcDest;
|
||||||
|
|
||||||
HMR = require('../index');
|
HMR = require('../index');
|
||||||
|
|
||||||
@ -39,12 +32,9 @@
|
|||||||
|
|
||||||
HMSTATUS = require('../core/status-codes');
|
HMSTATUS = require('../core/status-codes');
|
||||||
|
|
||||||
HME = require('../core/event-codes');
|
|
||||||
|
|
||||||
safeLoadJSON = require('../utils/safe-json-loader');
|
safeLoadJSON = require('../utils/safe-json-loader');
|
||||||
|
|
||||||
StringUtils = require('../utils/string.js');
|
//StringUtils = require '../utils/string.js'
|
||||||
|
|
||||||
_ = require('underscore');
|
_ = require('underscore');
|
||||||
|
|
||||||
OUTPUT = require('./out');
|
OUTPUT = require('./out');
|
||||||
@ -67,7 +57,14 @@
|
|||||||
|
|
||||||
_exitCallback = null;
|
_exitCallback = null;
|
||||||
|
|
||||||
main = module.exports = function(rawArgs, exitCallback) {
|
/*
|
||||||
|
A callable implementation of the HackMyResume CLI. Encapsulates the command
|
||||||
|
line interface as a single method accepting a parameter array.
|
||||||
|
@alias module:cli/main.main
|
||||||
|
@param rawArgs {Array} An array of command-line parameters. Will either be
|
||||||
|
process.argv (in production) or custom parameters (in test).
|
||||||
|
*/
|
||||||
|
module.exports = function(rawArgs, exitCallback) {
|
||||||
var args, initInfo, program;
|
var args, initInfo, program;
|
||||||
initInfo = initialize(rawArgs, exitCallback);
|
initInfo = initialize(rawArgs, exitCallback);
|
||||||
if (initInfo === null) {
|
if (initInfo === null) {
|
||||||
@ -96,13 +93,15 @@
|
|||||||
execute.call(this, sources, [], this.opts(), logMsg);
|
execute.call(this, sources, [], this.opts(), logMsg);
|
||||||
});
|
});
|
||||||
// Create the PEEK command
|
// Create the PEEK command
|
||||||
program.command('peek').arguments('<sources...>').description('Peek at a resume field or section').action(function(sources, sectionOrField) {
|
//.action(( sources, sectionOrField ) ->
|
||||||
|
program.command('peek').arguments('<sources...>').description('Peek at a resume field or section').action(function(sources) {
|
||||||
var dst;
|
var dst;
|
||||||
dst = (sources && sources.length > 1) ? [sources.pop()] : [];
|
dst = (sources && sources.length > 1) ? [sources.pop()] : [];
|
||||||
execute.call(this, sources, dst, this.opts(), logMsg);
|
execute.call(this, sources, dst, this.opts(), logMsg);
|
||||||
});
|
});
|
||||||
// Create the BUILD command
|
// Create the BUILD command
|
||||||
program.command('build').alias('generate').option('-t --theme <theme>', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css <option>', 'CSS linking / embedding').option('-p --pdf <engine>', 'PDF generation engine').option('--no-sort', 'Sort resume sections by date', false).option('--tips', 'Display theme tips and warnings.', false).option('--private', 'Include resume fields marked as private', false).option('--no-escape', "Turn off encoding in Handlebars themes.", false).description('Generate resume to multiple formats').action(function(sources, targets, options) {
|
//.action(( sources, targets, options ) ->
|
||||||
|
program.command('build').alias('generate').option('-t --theme <theme>', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css <option>', 'CSS linking / embedding').option('-p --pdf <engine>', 'PDF generation engine').option('--no-sort', 'Sort resume sections by date', false).option('--tips', 'Display theme tips and warnings.', false).option('--private', 'Include resume fields marked as private', false).option('--no-escape', 'Turn off encoding in Handlebars themes.', false).description('Generate resume to multiple formats').action(function() {
|
||||||
var x;
|
var x;
|
||||||
x = splitSrcDest.call(this);
|
x = splitSrcDest.call(this);
|
||||||
execute.call(this, x.src, x.dst, this.opts(), logMsg);
|
execute.call(this, x.src, x.dst, this.opts(), logMsg);
|
||||||
@ -166,7 +165,7 @@
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
// Override the .missingArgument behavior
|
// Override the .missingArgument behavior
|
||||||
Command.prototype.missingArgument = function(name) {
|
Command.prototype.missingArgument = function(/* unused */) {
|
||||||
if (this.name() !== 'help') {
|
if (this.name() !== 'help') {
|
||||||
_err.err({
|
_err.err({
|
||||||
verb: this.name(),
|
verb: this.name(),
|
||||||
@ -277,7 +276,7 @@
|
|||||||
prom.then(executeSuccess, executeFail);
|
prom.then(executeSuccess, executeFail);
|
||||||
};
|
};
|
||||||
|
|
||||||
executeSuccess = function(obj) {};
|
executeSuccess = function(/*obj*/) {};
|
||||||
|
|
||||||
// Can't call _exitCallback here (process.exit) when PDF is running in BK
|
// Can't call _exitCallback here (process.exit) when PDF is running in BK
|
||||||
//_exitCallback 0; return
|
//_exitCallback 0; return
|
||||||
@ -363,6 +362,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
logMsg = function() {
|
logMsg = function() {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
return _opts.silent || console.log.apply(console.log, arguments);
|
return _opts.silent || console.log.apply(console.log, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
19
dist/cli/out.js
vendored
19
dist/cli/out.js
vendored
@ -4,7 +4,7 @@
|
|||||||
@license MIT. See LICENSE.md for details.
|
@license MIT. See LICENSE.md for details.
|
||||||
@module cli/out
|
@module cli/out
|
||||||
*/
|
*/
|
||||||
var EXTEND, FS, HANDLEBARS, HME, LO, M2C, OutputHandler, PATH, YAML, _, chalk, dbgStyle, pad, printf;
|
var EXTEND, FS, HANDLEBARS, HME, M2C, OutputHandler, PATH, YAML, _, chalk, dbgStyle, pad, printf;
|
||||||
|
|
||||||
chalk = require('chalk');
|
chalk = require('chalk');
|
||||||
|
|
||||||
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
PATH = require('path');
|
PATH = require('path');
|
||||||
|
|
||||||
LO = require('lodash');
|
|
||||||
|
|
||||||
FS = require('fs');
|
FS = require('fs');
|
||||||
|
|
||||||
EXTEND = require('extend');
|
EXTEND = require('extend');
|
||||||
@ -32,7 +30,7 @@
|
|||||||
|
|
||||||
dbgStyle = 'cyan';
|
dbgStyle = 'cyan';
|
||||||
|
|
||||||
module.exports = OutputHandler = class OutputHandler {
|
OutputHandler = class OutputHandler {
|
||||||
constructor(opts) {
|
constructor(opts) {
|
||||||
this.init(opts);
|
this.init(opts);
|
||||||
return;
|
return;
|
||||||
@ -43,16 +41,15 @@
|
|||||||
this.msgs = YAML.load(PATH.join(__dirname, 'msg.yml')).events;
|
this.msgs = YAML.load(PATH.join(__dirname, 'msg.yml')).events;
|
||||||
}
|
}
|
||||||
|
|
||||||
log(msg) {
|
log() {
|
||||||
var finished;
|
var finished;
|
||||||
msg = msg || '';
|
|
||||||
printf = require('printf');
|
printf = require('printf');
|
||||||
finished = printf.apply(printf, arguments);
|
finished = printf.apply(printf, arguments);
|
||||||
return this.opts.silent || console.log(finished);
|
return this.opts.silent || console.log(finished); // eslint-disable-line no-console
|
||||||
}
|
}
|
||||||
|
|
||||||
do(evt) {
|
do(evt) {
|
||||||
var L, WRAP, adj, info, msg, msgs, numFormats, output, rawTpl, sty, style, suffix, template, that, themeName, tot;
|
var L, adj, info, msg, msgs, numFormats, output, rawTpl, sty, style, suffix, template, that, themeName, tot;
|
||||||
that = this;
|
that = this;
|
||||||
L = function() {
|
L = function() {
|
||||||
return that.log.apply(that, arguments);
|
return that.log.apply(that, arguments);
|
||||||
@ -84,7 +81,6 @@
|
|||||||
if (evt.cmd === 'build') {
|
if (evt.cmd === 'build') {
|
||||||
themeName = this.theme.name.toUpperCase();
|
themeName = this.theme.name.toUpperCase();
|
||||||
if (this.opts.tips && (this.theme.message || this.theme.render)) {
|
if (this.opts.tips && (this.theme.message || this.theme.render)) {
|
||||||
WRAP = require('word-wrap');
|
|
||||||
if (this.theme.message) {
|
if (this.theme.message) {
|
||||||
L(M2C(this.msgs.afterBuild.msg[0], 'cyan'), themeName);
|
L(M2C(this.msgs.afterBuild.msg[0], 'cyan'), themeName);
|
||||||
return L(M2C(this.theme.message, 'white'));
|
return L(M2C(this.theme.message, 'white'));
|
||||||
@ -157,7 +153,7 @@
|
|||||||
evt.schema = evt.schema.replace('jars', 'JSON Resume').toUpperCase();
|
evt.schema = evt.schema.replace('jars', 'JSON Resume').toUpperCase();
|
||||||
L(M2C(msgs[0], 'white') + chalk[style].bold(adj), evt.file, evt.schema);
|
L(M2C(msgs[0], 'white') + chalk[style].bold(adj), evt.file, evt.schema);
|
||||||
if (evt.violations) {
|
if (evt.violations) {
|
||||||
_.each(evt.violations, function(err, idx) {
|
_.each(evt.violations, function(err) {
|
||||||
L(chalk.yellow.bold('--> ') + chalk.yellow(err.field.replace('data.', 'resume.').toUpperCase() + ' ' + err.message));
|
L(chalk.yellow.bold('--> ') + chalk.yellow(err.field.replace('data.', 'resume.').toUpperCase() + ' ' + err.message));
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
@ -172,6 +168,7 @@
|
|||||||
}
|
}
|
||||||
// If the key was present, print it
|
// If the key was present, print it
|
||||||
if (evt.target !== void 0 && !evt.error) {
|
if (evt.target !== void 0 && !evt.error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
return console.dir(evt.target, {
|
return console.dir(evt.target, {
|
||||||
depth: null,
|
depth: null,
|
||||||
colors: true
|
colors: true
|
||||||
@ -186,6 +183,8 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = OutputHandler;
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
//# sourceMappingURL=out.js.map
|
//# sourceMappingURL=out.js.map
|
||||||
|
@ -7,15 +7,12 @@ Error-handling routines for HackMyResume.
|
|||||||
|
|
||||||
|
|
||||||
HMSTATUS = require '../core/status-codes'
|
HMSTATUS = require '../core/status-codes'
|
||||||
PKG = require '../../package.json'
|
|
||||||
FS = require 'fs'
|
FS = require 'fs'
|
||||||
FCMD = require '../index'
|
|
||||||
PATH = require 'path'
|
PATH = require 'path'
|
||||||
WRAP = require 'word-wrap'
|
WRAP = require 'word-wrap'
|
||||||
M2C = require '../utils/md2chalk'
|
M2C = require '../utils/md2chalk'
|
||||||
chalk = require 'chalk'
|
chalk = require 'chalk'
|
||||||
extend = require 'extend'
|
extend = require 'extend'
|
||||||
YAML = require 'yamljs'
|
|
||||||
printf = require 'printf'
|
printf = require 'printf'
|
||||||
SyntaxErrorEx = require '../utils/syntax-error-ex'
|
SyntaxErrorEx = require '../utils/syntax-error-ex'
|
||||||
require 'string.prototype.startswith'
|
require 'string.prototype.startswith'
|
||||||
@ -24,7 +21,7 @@ require 'string.prototype.startswith'
|
|||||||
|
|
||||||
###* Error handler for HackMyResume. All errors are handled here.
|
###* Error handler for HackMyResume. All errors are handled here.
|
||||||
@class ErrorHandler ###
|
@class ErrorHandler ###
|
||||||
ErrorHandler = module.exports =
|
module.exports =
|
||||||
|
|
||||||
init: ( debug, assert, silent ) ->
|
init: ( debug, assert, silent ) ->
|
||||||
@debug = debug
|
@debug = debug
|
||||||
@ -86,8 +83,7 @@ ErrorHandler = module.exports =
|
|||||||
format_custom: ( msg ) -> msg
|
format_custom: ( msg ) -> msg
|
||||||
|
|
||||||
|
|
||||||
|
_defaultLog = () -> console.log.apply console.log, arguments # eslint-disable-line no-console
|
||||||
_defaultLog = () -> console.log.apply console.log, arguments
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -180,6 +176,7 @@ assembleError = ( ex ) ->
|
|||||||
|
|
||||||
when HMSTATUS.readError
|
when HMSTATUS.readError
|
||||||
if !ex.quiet
|
if !ex.quiet
|
||||||
|
# eslint-disable-next-line no-console
|
||||||
console.error(printf( M2C(this.msgs.readError.msg, 'red'), ex.file))
|
console.error(printf( M2C(this.msgs.readError.msg, 'red'), ex.file))
|
||||||
msg = ex.inner.toString()
|
msg = ex.inner.toString()
|
||||||
etype = 'error'
|
etype = 'error'
|
||||||
@ -205,6 +202,7 @@ assembleError = ( ex ) ->
|
|||||||
|
|
||||||
when HMSTATUS.parseError
|
when HMSTATUS.parseError
|
||||||
if SyntaxErrorEx.is ex.inner
|
if SyntaxErrorEx.is ex.inner
|
||||||
|
# eslint-disable-next-line no-console
|
||||||
console.error printf( M2C(this.msgs.readError.msg, 'red'), ex.file )
|
console.error printf( M2C(this.msgs.readError.msg, 'red'), ex.file )
|
||||||
se = new SyntaxErrorEx ex, ex.raw
|
se = new SyntaxErrorEx ex, ex.raw
|
||||||
if se.line? and se.col?
|
if se.line? and se.col?
|
||||||
@ -231,6 +229,7 @@ assembleError = ( ex ) ->
|
|||||||
when HMSTATUS.invalidOptionsFile
|
when HMSTATUS.invalidOptionsFile
|
||||||
msg = M2C @msgs.invalidOptionsFile.msg[0]
|
msg = M2C @msgs.invalidOptionsFile.msg[0]
|
||||||
if SyntaxErrorEx.is ex.inner
|
if SyntaxErrorEx.is ex.inner
|
||||||
|
# eslint-disable-next-line no-console
|
||||||
console.error printf( M2C(this.msgs.readError.msg, 'red'), ex.file )
|
console.error printf( M2C(this.msgs.readError.msg, 'red'), ex.file )
|
||||||
se = new SyntaxErrorEx ex, ex.raw
|
se = new SyntaxErrorEx ex, ex.raw
|
||||||
if se.line? and se.col?
|
if se.line? and se.col?
|
||||||
|
@ -13,9 +13,8 @@ EXTEND = require 'extend'
|
|||||||
chalk = require 'chalk'
|
chalk = require 'chalk'
|
||||||
PATH = require 'path'
|
PATH = require 'path'
|
||||||
HMSTATUS = require '../core/status-codes'
|
HMSTATUS = require '../core/status-codes'
|
||||||
HME = require '../core/event-codes'
|
|
||||||
safeLoadJSON = require '../utils/safe-json-loader'
|
safeLoadJSON = require '../utils/safe-json-loader'
|
||||||
StringUtils = require '../utils/string.js'
|
#StringUtils = require '../utils/string.js'
|
||||||
_ = require 'underscore'
|
_ = require 'underscore'
|
||||||
OUTPUT = require './out'
|
OUTPUT = require './out'
|
||||||
PAD = require 'string-padding'
|
PAD = require 'string-padding'
|
||||||
@ -37,7 +36,7 @@ line interface as a single method accepting a parameter array.
|
|||||||
@param rawArgs {Array} An array of command-line parameters. Will either be
|
@param rawArgs {Array} An array of command-line parameters. Will either be
|
||||||
process.argv (in production) or custom parameters (in test).
|
process.argv (in production) or custom parameters (in test).
|
||||||
###
|
###
|
||||||
main = module.exports = ( rawArgs, exitCallback ) ->
|
module.exports = ( rawArgs, exitCallback ) ->
|
||||||
|
|
||||||
initInfo = initialize( rawArgs, exitCallback )
|
initInfo = initialize( rawArgs, exitCallback )
|
||||||
if initInfo is null
|
if initInfo is null
|
||||||
@ -107,7 +106,8 @@ main = module.exports = ( rawArgs, exitCallback ) ->
|
|||||||
.command('peek')
|
.command('peek')
|
||||||
.arguments('<sources...>')
|
.arguments('<sources...>')
|
||||||
.description('Peek at a resume field or section')
|
.description('Peek at a resume field or section')
|
||||||
.action(( sources, sectionOrField ) ->
|
#.action(( sources, sectionOrField ) ->
|
||||||
|
.action(( sources ) ->
|
||||||
dst = if (sources && sources.length > 1) then [sources.pop()] else []
|
dst = if (sources && sources.length > 1) then [sources.pop()] else []
|
||||||
execute.call( this, sources, dst, this.opts(), logMsg)
|
execute.call( this, sources, dst, this.opts(), logMsg)
|
||||||
return
|
return
|
||||||
@ -124,9 +124,10 @@ main = module.exports = ( rawArgs, exitCallback ) ->
|
|||||||
.option('--no-sort', 'Sort resume sections by date', false)
|
.option('--no-sort', 'Sort resume sections by date', false)
|
||||||
.option('--tips', 'Display theme tips and warnings.', false)
|
.option('--tips', 'Display theme tips and warnings.', false)
|
||||||
.option('--private', 'Include resume fields marked as private', false)
|
.option('--private', 'Include resume fields marked as private', false)
|
||||||
.option('--no-escape', "Turn off encoding in Handlebars themes.", false)
|
.option('--no-escape', 'Turn off encoding in Handlebars themes.', false)
|
||||||
.description('Generate resume to multiple formats')
|
.description('Generate resume to multiple formats')
|
||||||
.action(( sources, targets, options ) ->
|
#.action(( sources, targets, options ) ->
|
||||||
|
.action(->
|
||||||
x = splitSrcDest.call( this );
|
x = splitSrcDest.call( this );
|
||||||
execute.call( this, x.src, x.dst, this.opts(), logMsg)
|
execute.call( this, x.src, x.dst, this.opts(), logMsg)
|
||||||
return
|
return
|
||||||
@ -188,7 +189,7 @@ initialize = ( ar, exitCallback ) ->
|
|||||||
_err.err fluenterror: HMSTATUS.invalidCommand, quit: true, attempted: o.orgVerb, true
|
_err.err fluenterror: HMSTATUS.invalidCommand, quit: true, attempted: o.orgVerb, true
|
||||||
|
|
||||||
# Override the .missingArgument behavior
|
# Override the .missingArgument behavior
|
||||||
Command.prototype.missingArgument = (name) ->
|
Command.prototype.missingArgument = (### unused ###) ->
|
||||||
if this.name() != 'help'
|
if this.name() != 'help'
|
||||||
_err.err
|
_err.err
|
||||||
verb: @name()
|
verb: @name()
|
||||||
@ -293,7 +294,7 @@ execute = ( src, dst, opts, log ) ->
|
|||||||
|
|
||||||
|
|
||||||
### Success handler for verb invocations. Calls process.exit by default ###
|
### Success handler for verb invocations. Calls process.exit by default ###
|
||||||
executeSuccess = (obj) ->
|
executeSuccess = (###obj###) ->
|
||||||
# Can't call _exitCallback here (process.exit) when PDF is running in BK
|
# Can't call _exitCallback here (process.exit) when PDF is running in BK
|
||||||
#_exitCallback 0; return
|
#_exitCallback 0; return
|
||||||
|
|
||||||
@ -385,4 +386,5 @@ splitSrcDest = () ->
|
|||||||
|
|
||||||
### Simple logging placeholder. ###
|
### Simple logging placeholder. ###
|
||||||
logMsg = () ->
|
logMsg = () ->
|
||||||
|
# eslint-disable-next-line no-console
|
||||||
_opts.silent || console.log.apply( console.log, arguments )
|
_opts.silent || console.log.apply( console.log, arguments )
|
||||||
|
@ -11,7 +11,6 @@ HME = require('../core/event-codes')
|
|||||||
_ = require('underscore')
|
_ = require('underscore')
|
||||||
M2C = require('../utils/md2chalk.js')
|
M2C = require('../utils/md2chalk.js')
|
||||||
PATH = require('path')
|
PATH = require('path')
|
||||||
LO = require('lodash')
|
|
||||||
FS = require('fs')
|
FS = require('fs')
|
||||||
EXTEND = require('extend')
|
EXTEND = require('extend')
|
||||||
HANDLEBARS = require('handlebars')
|
HANDLEBARS = require('handlebars')
|
||||||
@ -23,7 +22,7 @@ dbgStyle = 'cyan';
|
|||||||
|
|
||||||
|
|
||||||
###* A stateful output module. All HMR console output handled here. ###
|
###* A stateful output module. All HMR console output handled here. ###
|
||||||
module.exports = class OutputHandler
|
class OutputHandler
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -40,11 +39,10 @@ module.exports = class OutputHandler
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
log: ( msg ) ->
|
log: ->
|
||||||
msg = msg || ''
|
|
||||||
printf = require('printf')
|
printf = require('printf')
|
||||||
finished = printf.apply( printf, arguments )
|
finished = printf.apply( printf, arguments )
|
||||||
@opts.silent || console.log( finished )
|
@opts.silent || console.log( finished ) # eslint-disable-line no-console
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +92,6 @@ module.exports = class OutputHandler
|
|||||||
if evt.cmd == 'build'
|
if evt.cmd == 'build'
|
||||||
themeName = this.theme.name.toUpperCase()
|
themeName = this.theme.name.toUpperCase()
|
||||||
if this.opts.tips && (this.theme.message || this.theme.render)
|
if this.opts.tips && (this.theme.message || this.theme.render)
|
||||||
WRAP = require('word-wrap')
|
|
||||||
if this.theme.message
|
if this.theme.message
|
||||||
L( M2C( this.msgs.afterBuild.msg[0], 'cyan' ), themeName )
|
L( M2C( this.msgs.afterBuild.msg[0], 'cyan' ), themeName )
|
||||||
L( M2C( this.theme.message, 'white' ))
|
L( M2C( this.theme.message, 'white' ))
|
||||||
@ -153,7 +150,7 @@ module.exports = class OutputHandler
|
|||||||
L(M2C( msgs[0], 'white' ) + chalk[style].bold(adj), evt.file, evt.schema)
|
L(M2C( msgs[0], 'white' ) + chalk[style].bold(adj), evt.file, evt.schema)
|
||||||
|
|
||||||
if evt.violations
|
if evt.violations
|
||||||
_.each evt.violations, (err,idx) ->
|
_.each evt.violations, (err) ->
|
||||||
L( chalk.yellow.bold('--> ') +
|
L( chalk.yellow.bold('--> ') +
|
||||||
chalk.yellow(err.field.replace('data.','resume.').toUpperCase() +
|
chalk.yellow(err.field.replace('data.','resume.').toUpperCase() +
|
||||||
' ' + err.message))
|
' ' + err.message))
|
||||||
@ -172,6 +169,7 @@ module.exports = class OutputHandler
|
|||||||
|
|
||||||
# If the key was present, print it
|
# If the key was present, print it
|
||||||
if evt.target != undefined and !evt.error
|
if evt.target != undefined and !evt.error
|
||||||
|
# eslint-disable-next-line no-console
|
||||||
console.dir( evt.target, { depth: null, colors: true } )
|
console.dir( evt.target, { depth: null, colors: true } )
|
||||||
|
|
||||||
# If the key was not present, but no error occurred, print it
|
# If the key was not present, but no error occurred, print it
|
||||||
@ -180,3 +178,5 @@ module.exports = class OutputHandler
|
|||||||
|
|
||||||
else if evt.error
|
else if evt.error
|
||||||
L chalk.red( evt.error.inner.inner )
|
L chalk.red( evt.error.inner.inner )
|
||||||
|
|
||||||
|
module.exports = OutputHandler
|
||||||
|
Loading…
Reference in New Issue
Block a user