mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-12-22 21:37:21 +00:00
Fix PEEK command.
This commit is contained in:
parent
49ae016f08
commit
5bf4bda6de
1
dist/cli/main.js
vendored
1
dist/cli/main.js
vendored
@ -236,7 +236,6 @@ Definition of the `main` function.
|
||||
finalErrorCode = -1;
|
||||
if (err) {
|
||||
finalErrorCode = err.fluenterror ? err.fluenterror : err;
|
||||
console.log(err.stack);
|
||||
}
|
||||
if (_opts.debug) {
|
||||
msgs = require('./msg').errors;
|
||||
|
2
dist/cli/out.js
vendored
2
dist/cli/out.js
vendored
@ -147,7 +147,7 @@ Output routines for HackMyResume.
|
||||
} else {
|
||||
L(M2C(this.msgs.beforePeek.msg[1], sty), evt.file);
|
||||
}
|
||||
if (evt.target !== void 0) {
|
||||
if (evt.target !== void 0 && !evt.error) {
|
||||
return console.dir(evt.target, {
|
||||
depth: null,
|
||||
colors: true
|
||||
|
7
dist/verbs/peek.js
vendored
7
dist/verbs/peek.js
vendored
@ -52,8 +52,7 @@ Implementation of the 'peek' verb for HackMyResume.
|
||||
}
|
||||
tgt = _peekOne.call(this, t, objPath);
|
||||
if (tgt.error) {
|
||||
tgt.quit = opts.assert;
|
||||
this.err(tgt.fluenterror, tgt);
|
||||
this.setError(tgt.error.fluenterror, tgt.error);
|
||||
}
|
||||
return tgt;
|
||||
}, this);
|
||||
@ -97,8 +96,8 @@ Implementation of the 'peek' verb for HackMyResume.
|
||||
error: pkgError
|
||||
});
|
||||
return {
|
||||
val: tgt,
|
||||
errpr: pkgError
|
||||
val: obj.ex ? void 0 : tgt,
|
||||
error: pkgError
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -271,7 +271,6 @@ executeFail = (err) ->
|
||||
finalErrorCode = -1
|
||||
if err
|
||||
finalErrorCode = if err.fluenterror then err.fluenterror else err
|
||||
console.log err.stack
|
||||
if _opts.debug
|
||||
msgs = require('./msg').errors;
|
||||
logMsg printf M2C( msgs.exiting.msg, 'cyan' ), finalErrorCode
|
||||
|
@ -165,12 +165,12 @@ module.exports = class OutputHandler
|
||||
L(M2C(this.msgs.beforePeek.msg[1], sty), evt.file)
|
||||
|
||||
# If the key was present, print it
|
||||
if evt.target != undefined
|
||||
if evt.target != undefined and !evt.error
|
||||
console.dir( evt.target, { depth: null, colors: true } )
|
||||
|
||||
# If the key was not present, but no error occurred, print it
|
||||
else if !evt.error
|
||||
L(M2C( this.msgs.afterPeek.msg, 'yellow'), evt.requested, evt.file);
|
||||
L M2C( this.msgs.afterPeek.msg, 'yellow'), evt.requested, evt.file
|
||||
|
||||
else if evt.error
|
||||
L( chalk.red( evt.error.inner.inner ));
|
||||
L chalk.red( evt.error.inner.inner )
|
||||
|
@ -31,11 +31,14 @@ _peek = ( src, dst, opts ) ->
|
||||
objPath = (dst && dst[0]) || ''
|
||||
|
||||
results = _.map src, ( t ) ->
|
||||
|
||||
return { } if opts.assert and @hasError()
|
||||
|
||||
tgt = _peekOne.call @, t, objPath
|
||||
if tgt.error
|
||||
tgt.quit = opts.assert
|
||||
@err tgt.fluenterror, tgt
|
||||
@setError tgt.error.fluenterror, tgt.error
|
||||
#tgt.error.quit = opts.assert
|
||||
#@err tgt.error.fluenterror, tgt.error
|
||||
tgt
|
||||
, @
|
||||
|
||||
@ -56,9 +59,9 @@ _peekOne = ( t, objPath ) ->
|
||||
obj = safeLoadJSON t
|
||||
|
||||
# Fetch the requested object path (or the entire file)
|
||||
tgt = null;
|
||||
tgt = null
|
||||
if !obj.ex
|
||||
tgt = if objPath then __.get obj.json, objPath else obj.json;
|
||||
tgt = if objPath then __.get obj.json, objPath else obj.json
|
||||
|
||||
## safeLoadJSON can only return a READ error or a PARSE error
|
||||
pkgError = null
|
||||
@ -68,7 +71,6 @@ _peekOne = ( t, objPath ) ->
|
||||
obj.ex.quiet = true
|
||||
pkgError = fluenterror: errCode, inner: obj.ex
|
||||
|
||||
|
||||
# Fire the 'afterPeek' event with collected info
|
||||
@stat HMEVENT.afterPeek,
|
||||
file: t
|
||||
@ -76,4 +78,5 @@ _peekOne = ( t, objPath ) ->
|
||||
target: if obj.ex then undefined else tgt
|
||||
error: pkgError
|
||||
|
||||
val: tgt, errpr: pkgError
|
||||
val: if obj.ex then undefined else tgt
|
||||
error: pkgError
|
||||
|
@ -19,16 +19,23 @@
|
||||
3|peek
|
||||
14|peek doesnt-exist.json
|
||||
14|peek doesnt-exist.json not.a.path
|
||||
15|peek node_modules/fresh-test-resumes/src/fresh/johnny-trouble.broken.json
|
||||
0|peek test/resumes/jrs-0.0.0/richard-hendriks.json work[0]
|
||||
0|peek node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json employment.history[1]
|
||||
0|peek node_modules/fresh-test-resumes/src/fresh/johnny-trouble.json skills.sets
|
||||
3|build
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json test/sandbox/cli-test/jane/resume.html
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json test/sandbox/cli-test/jane/resume.pdf
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json test/sandbox/cli-test/jane/resume.md
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json test/sandbox/cli-test/jane/resume.txt
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json test/sandbox/cli-test/jane/resume.yml
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json test/sandbox/cli-test/jane/resume.json
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.all
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.html
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.pdf
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.md
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.txt
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.yml
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.json
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.all --theme modern
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.all --theme compact
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.all --theme positive
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.all --theme basis
|
||||
0|build node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json TO test/sandbox/cli-test/jane/resume.all --theme awesome
|
||||
14|build doesnt-exist.json
|
||||
14|build doesnt-exist.json -t not-a-theme
|
||||
14|build doesnt-exist.json -t node_modules/not-a-theme
|
||||
|
@ -37,7 +37,15 @@ function genThemes( title, src, fmt ) {
|
||||
};
|
||||
try {
|
||||
var v = new HMR.verbs.build();
|
||||
v.invoke( src, dst, opts );
|
||||
var p = v.invoke( src, dst, opts );
|
||||
p.then(
|
||||
function(obj){
|
||||
|
||||
},
|
||||
function(obj){
|
||||
throw obj;
|
||||
}
|
||||
);
|
||||
}
|
||||
catch(ex) {
|
||||
console.error( ex );
|
||||
|
Loading…
Reference in New Issue
Block a user