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 _readline from "readline";
|
||||||
import { exec } from 'node:child_process';
|
import { exec } from "node:child_process";
|
||||||
|
|
||||||
const execSync = (command)=>new Promise((resolve,rejects)=>{
|
const execSync = command =>
|
||||||
exec(command,(err,stdout,stderr)=>{
|
new Promise((resolve, rejects) => {
|
||||||
if(err){
|
exec(command, (err, stdout, stderr) => {
|
||||||
console.error(stderr)
|
if (err) {
|
||||||
rejects(stderr)
|
console.error(stderr);
|
||||||
}else{
|
rejects(stderr);
|
||||||
console.log(stdout)
|
} else {
|
||||||
resolve(stdout)
|
console.log(stdout);
|
||||||
}
|
resolve(stdout);
|
||||||
})
|
}
|
||||||
})
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const readline = _readline.createInterface({
|
const readline = _readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout
|
output: process.stdout
|
||||||
});
|
});
|
||||||
|
|
||||||
const input = async function (question) {
|
const input = question =>
|
||||||
return await new Promise((resolve, rejects) => {
|
new Promise((resolve, rejects) => {
|
||||||
try {
|
try {
|
||||||
readline.question(question, output => {
|
readline.question(question, output => {
|
||||||
readline.close();
|
readline.close();
|
||||||
@@ -29,15 +30,14 @@ const input = async function (question) {
|
|||||||
rejects(e);
|
rejects(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
const generateDate = function () {
|
const generateDate = function () {
|
||||||
const dateNow = new Date();
|
const dateNow = new Date();
|
||||||
const paddingNumber = function(num){
|
const paddingNumber = function (num) {
|
||||||
return ("0" + num).slice(-2)
|
return ("0" + num).slice(-2);
|
||||||
}
|
};
|
||||||
let year = dateNow.getFullYear();
|
let year = dateNow.getFullYear();
|
||||||
let month = paddingNumber((dateNow.getMonth() + 1));
|
let month = paddingNumber(dateNow.getMonth() + 1);
|
||||||
let day = paddingNumber(dateNow.getDate());
|
let day = paddingNumber(dateNow.getDate());
|
||||||
let hour = paddingNumber(dateNow.getHours());
|
let hour = paddingNumber(dateNow.getHours());
|
||||||
let minute = paddingNumber(dateNow.getMinutes());
|
let minute = paddingNumber(dateNow.getMinutes());
|
||||||
@@ -45,11 +45,10 @@ const generateDate = function () {
|
|||||||
return `${year}-${month}-${day} ${hour}:${minute}:${seconds}`;
|
return `${year}-${month}-${day} ${hour}:${minute}:${seconds}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(async function () {
|
||||||
;(async function(){
|
const remark = await input("remark:");
|
||||||
const remark = await input('remark:')
|
const message = `update:${generateDate()} ${remark ? "-remark:" + remark : ""} -AutoCommit`;
|
||||||
const message = `update:${generateDate()} ${remark ? '-remark:'+remark : ''} -AutoCommit`
|
await execSync(`git add ."`);
|
||||||
await execSync(`git add ."`);
|
await execSync(`git commit -m "${message}"`);
|
||||||
await execSync(`git commit -m "${message}"`);
|
await execSync("git push");
|
||||||
await execSync("git push");
|
})();
|
||||||
})()
|
|
||||||
Reference in new issue
Block a user