update:2024-07-06 12:34:16 -remark:format code -AutoCommit
This commit is contained in:
1 parent
05d6654e3f
commit
a65ec0e7db
1 file changed
+26
-27
+26
-27
@@ -1,25 +1,26 @@
|
||||
import _readline from "readline";
|
||||
import { exec } from 'node:child_process';
|
||||
import { exec } from "node:child_process";
|
||||
|
||||
const execSync = (command)=>new Promise((resolve,rejects)=>{
|
||||
exec(command,(err,stdout,stderr)=>{
|
||||
if(err){
|
||||
console.error(stderr)
|
||||
rejects(stderr)
|
||||
}else{
|
||||
console.log(stdout)
|
||||
resolve(stdout)
|
||||
}
|
||||
})
|
||||
})
|
||||
const execSync = command =>
|
||||
new Promise((resolve, rejects) => {
|
||||
exec(command, (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
console.error(stderr);
|
||||
rejects(stderr);
|
||||
} else {
|
||||
console.log(stdout);
|
||||
resolve(stdout);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const readline = _readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
const input = async function (question) {
|
||||
return await new Promise((resolve, rejects) => {
|
||||
const input = question =>
|
||||
new Promise((resolve, rejects) => {
|
||||
try {
|
||||
readline.question(question, output => {
|
||||
readline.close();
|
||||
@@ -29,15 +30,14 @@ const input = async function (question) {
|
||||
rejects(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const generateDate = function () {
|
||||
const dateNow = new Date();
|
||||
const paddingNumber = function(num){
|
||||
return ("0" + num).slice(-2)
|
||||
}
|
||||
const paddingNumber = function (num) {
|
||||
return ("0" + num).slice(-2);
|
||||
};
|
||||
let year = dateNow.getFullYear();
|
||||
let month = paddingNumber((dateNow.getMonth() + 1));
|
||||
let month = paddingNumber(dateNow.getMonth() + 1);
|
||||
let day = paddingNumber(dateNow.getDate());
|
||||
let hour = paddingNumber(dateNow.getHours());
|
||||
let minute = paddingNumber(dateNow.getMinutes());
|
||||
@@ -45,11 +45,10 @@ const generateDate = function () {
|
||||
return `${year}-${month}-${day} ${hour}:${minute}:${seconds}`;
|
||||
};
|
||||
|
||||
|
||||
;(async function(){
|
||||
const remark = await input('remark:')
|
||||
const message = `update:${generateDate()} ${remark ? '-remark:'+remark : ''} -AutoCommit`
|
||||
await execSync(`git add ."`);
|
||||
await execSync(`git commit -m "${message}"`);
|
||||
await execSync("git push");
|
||||
})()
|
||||
(async function () {
|
||||
const remark = await input("remark:");
|
||||
const message = `update:${generateDate()} ${remark ? "-remark:" + remark : ""} -AutoCommit`;
|
||||
await execSync(`git add ."`);
|
||||
await execSync(`git commit -m "${message}"`);
|
||||
await execSync("git push");
|
||||
})();
|
||||
Reference in new issue
Block a user