function getNowFormatDate(type='end') {
let date = new Date(),
year = date.getFullYear(),
month = date.getMonth() + 1,
strDate = date.getDate()
if (month < 10) month = `0${month}`
if (strDate < 10) strDate = `0${strDate}`
if(type=="start"){
return `${year}-${month}-01`
}else{
return `${year}-${month}-${strDate}`
}
}
let yourname = "上海.吴义超",
now = new Date(),
startDate =getNowFormatDate('start'),
endDate= getNowFormatDate()
let gitLog = `git log --author="${yourname}" --since=${startDate} --until=${endDate} --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s", add, subs, loc }' -`
console.log(gitLog)
console