Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ cli(
alias: 'g',
default: 1,
},
prefix: {
type: String,
description: 'String to prefix to the generated commit message.',
default: '',
},
},

commands: [
Expand All @@ -44,6 +49,7 @@ cli(
} else {
aicommits(
argv.flags.generate,
argv.flags.prefix,
rawArgv,
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/commands/aicommits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { generateCommitMessage } from '../utils/openai.js';

export default async (
generate: number,
prefix: string,
rawArgv: string[],
) => (async () => {
intro(bgCyan(black(' aicommits ')));
Expand Down Expand Up @@ -51,6 +52,8 @@ export default async (
let message;
if (messages.length === 1) {
[message] = messages;
message = `${prefix} ${message}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the benefit of the space, but I'm afraid it becomes restrictive for those that don't want it and will later ask for a CLI flag to disable the space or something. But, I also haven't been able to come out with an example where they wouldn't want the space.

What do you think?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case I like the space, because it is usually a ticker number like FOO-123: ${message}. However, if the space is not added, it could be added in the same prefix.

Copy link
Author

@aslakhol aslakhol May 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered this and in the end I figured that for the few cases where no space would be needed people could edit the commit after the fact like before.

But on the other hand I don't personally mind removing the space. I use this with an alias that injects the punctuation I need so it would be trivial to include a space in that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@privatenumber Want me to get rid of the space?


const confirmed = await confirm({
message: `Use this commit message?\n\n ${message}\n`,
});
Expand Down