forked from nooqta/git-commit-gpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·36 lines (29 loc) · 937 Bytes
/
index.js
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
32
33
34
35
36
#!/usr/bin/env node
import gptCommit from "./commands/gpt-commit.js";
import { program } from "commander";
const gitExtension = (args) => {
// Extract the command and arguments from the command line
const [command, ...rest] = args;
program
.command("commit")
.description("Generate a Git commit message based on the summary of changes")
.action(async () => {
await gptCommit(...rest);
});
// Add more commands here
// program
// .command("cms")
// .description("Generate a git commit message based on the summary of changes, just print it out")
// .action(async () ={
// await gptCommit();
// })
// Handle invalid commands
program.on("command:*", () => {
console.error("Invalid command: %s\n", program.args.join(" "));
program.help();
process.exit(1);
});
program.parse(process.argv);
};
gitExtension(process.argv.slice(2));
export default gitExtension;