xgqfrms / git

git all in one
https://git.xgqfrms.xyz
MIT License
2 stars 1 forks source link

git auto commit #22

Open xgqfrms opened 4 years ago

xgqfrms commented 4 years ago

https://github.com/yi-ge/git-auto-commit

loop.sh

# git auto commit

if [ ! $1 ]; then  
   echo 'ERROR: Need to apply loop param'    
   exit  
fi  
for i in $(seq 1 $1)
do 
   `sh ./commit.sh`
   time=`date +'%G-%m-%d %H:%M:%S' -d '-1 days'`
   timedatectl set-time "$time"
done
xgqfrms commented 4 years ago

add.js


//日期格式化,格式化后:2018-01-26 21:25:12
Date.prototype.format = function(format) {
    var o = {
        "M+": this.getMonth() + 1, //month 
        "d+": this.getDate(), //day 
        "h+": this.getHours(), //hour 
        "m+": this.getMinutes(), //minute 
        "s+": this.getSeconds(), //second 
        "q+": Math.floor((this.getMonth() + 3) / 3), //quarter 
        "S": this.getMilliseconds() //millisecond 
    }
    if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
        (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1,
                RegExp.$1.length == 1 ? o[k] :
                ("00" + o[k]).substr(("" + o[k]).length));
    return format;
}

let fs = require('fs');
let time = (new Date()).format("yyyy年MM月dd日 hh:mm:ss");
fs.appendFileSync('records.txt', `${time}\n\n`);