-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
32 lines (27 loc) · 810 Bytes
/
Copy pathindex.ts
File metadata and controls
32 lines (27 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!usr/bin/env node
import { consola } from "consola";
import { Command } from "commander";
import { execa } from "execa";
const runCLI = () => {
const program = new Command();
program
.name("commit-bot")
.description("git commit and push tools")
.version("1.0.0")
.argument("<branch>")
.argument("<cms>") //cms => commit message
.action(async (branch: string, cms: any) => {
try {
await execa("git", ["add", "."]);
const result1 = await execa("git", ["commit", "-m", cms]);
const result2 = await execa("git", ["push", "origin", branch]);
consola.log(result1.stdout);
consola.log(result2.stdout);
} catch (err: any) {
consola.error(err.stderr);
process.exit(1);
}
});
program.parse();
};
runCLI();