Skip to content

Commit

Permalink
在命令行中输出颜色日志
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Aug 10, 2015
1 parent 14ac8ac commit da6054e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var log = console.log;
var clc = require('cli-color');
var info = require('./../lib/info.json');
var basicinfo = info.basicinfo;//基本信息数据:
var education = info.education;//教育经历数据:
Expand All @@ -11,7 +12,7 @@ var itskill = info.itskill;//教育经历数据:
function preview_basicinfo(){
var dt = basicinfo.data
log()
log(" "+ basicinfo.title + ': ' +(dt.name.val||'') )
log(" "+ clc.xterm(46).bold(basicinfo.title + ': ' +(dt.name.val||'')) )
log()
log(" " + (dt.workExperience?dt.workExperience.val + '|' :'') +
(dt.gender?dt.gender.val + '|' :'') +
Expand All @@ -38,13 +39,13 @@ function preview_basicinfo(){
function preview_education(){
var edu = education.data;
log()
log(" "+education.title)
log(" "+clc.xterm(46)(education.title))
for (var i = 0; i < edu.length; i++) {
for(var a in edu[i]){
if(a === "timePeriod") log(),
log(" ■ " + edu[i][a].val),
log(" " + clc.xterm(161)('■ ') + edu[i][a].val),
log(" ----------------------------");
else log(" › " + edu[i][a].info + " : " + edu[i][a].val);
else log(" " + clc.xterm(161)('› ') + edu[i][a].info + " : " + edu[i][a].val);
}
};
log()
Expand All @@ -54,7 +55,7 @@ function preview_education(){
function preview_itskill(){
var its = itskill.data;
log()
log(" "+itskill.title)
log(" "+clc.xterm(46)(itskill.title))
log()
for (var i = 0; i < its.length; i++) {

Expand All @@ -66,7 +67,7 @@ function preview_itskill(){
// log(" ■ " + (its[i][a]? a + ':' + its[i][a]:"") )
}
}
log(" ■ " + txt)
log(" " + clc.xterm(161)('■ ') + txt)
// log(" ----------------------------");
};
log()
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"author": "kenny wang <[email protected]> ",
"license": "MIT",
"dependencies": {
"cli-color": "^1.0.0",
"commander": "^2.8.1"
}
}

0 comments on commit da6054e

Please sign in to comment.