feat: pass down argv to git commit (#70)
This commit is contained in:
13
src/cli.ts
13
src/cli.ts
@@ -15,11 +15,18 @@ import {
|
|||||||
generateCommitMessage,
|
generateCommitMessage,
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
|
|
||||||
|
const rawArgv = process.argv.slice(2);
|
||||||
|
|
||||||
const argv = cli({
|
const argv = cli({
|
||||||
name: 'aicommits',
|
name: 'aicommits',
|
||||||
|
|
||||||
version,
|
version,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since this is a wrapper around `git commit`,
|
||||||
|
* flags should not overlap with it
|
||||||
|
* https://git-scm.com/docs/git-commit
|
||||||
|
*/
|
||||||
flags: {
|
flags: {
|
||||||
generate: {
|
generate: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -32,7 +39,9 @@ const argv = cli({
|
|||||||
help: {
|
help: {
|
||||||
description,
|
description,
|
||||||
},
|
},
|
||||||
});
|
|
||||||
|
ignoreArgv: type => type === 'unknown-flag' || type === 'argument',
|
||||||
|
}, undefined, rawArgv);
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
intro(bgCyan(black(' aicommits ')));
|
intro(bgCyan(black(' aicommits ')));
|
||||||
@@ -91,7 +100,7 @@ const argv = cli({
|
|||||||
message = selected;
|
message = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
await execa('git', ['commit', '-m', message]);
|
await execa('git', ['commit', '-m', message, ...rawArgv]);
|
||||||
|
|
||||||
outro(`${green('✔')} Successfully committed!`);
|
outro(`${green('✔')} Successfully committed!`);
|
||||||
})().catch((error) => {
|
})().catch((error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user