Skip to content

Commit ef003bd

Browse files
Add Detailed Explanation of OCO_MESSAGE_TEMPLATE_PLACEHOLDER Feature to README.md (#242)
* 📝 docs(README.md): add detailed explanation of OCO_MESSAGE_TEMPLATE_PLACEHOLDER feature
1 parent 916ddf0 commit ef003bd

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Local config still has more priority than Global config, but you may set `OCO_MO
135135
Simply set any of the variables above like this:
136136

137137
```sh
138-
oco config set OCO_OPENAI_API_KEY=gpt-4
138+
oco config set OCO_MODEL=gpt-4
139139
```
140140

141141
Configure [GitMoji](https://gitmoji.dev/) to preface a message.
@@ -209,6 +209,31 @@ oco '$msg #205’
209209

210210
> opencommit examines placeholders in the parameters, allowing you to append additional information before and after the placeholders, such as the relevant Issue or Pull Request. Similarly, you have the option to customize the OCO_MESSAGE_TEMPLATE_PLACEHOLDER configuration item, for example, simplifying it to $m!"
211211

212+
### Message Template Placeholder Config
213+
214+
#### Overview
215+
216+
The `OCO_MESSAGE_TEMPLATE_PLACEHOLDER` feature in the `opencommit` tool allows users to embed a custom message within the generated commit message using a template function. This configuration is designed to enhance the flexibility and customizability of commit messages, making it easier for users to include relevant information directly within their commits.
217+
218+
#### Implementation Details
219+
220+
In our codebase, the implementation of this feature can be found in the following segment:
221+
```javascript
222+
commitMessage = messageTemplate.replace(
223+
config?.OCO_MESSAGE_TEMPLATE_PLACEHOLDER,
224+
commitMessage
225+
);
226+
```
227+
This line is responsible for replacing the placeholder in the `messageTemplate` with the actual `commitMessage`.
228+
229+
#### Usage
230+
231+
For instance, using the command `oco '$msg #205’`, users can leverage this feature. The provided code represents the backend mechanics of such commands, ensuring that the placeholder is replaced with the appropriate commit message.
232+
233+
#### Committing with the Message
234+
235+
Once users have generated their desired commit message, they can proceed to commit using the generated message. By understanding the feature's full potential and its implementation details, users can confidently use the generated messages for their commits.
236+
212237
### Ignore files
213238

214239
You can remove files from being sent to OpenAI by creating a `.opencommitignore` file. For example:

0 commit comments

Comments
 (0)