Crates.io | inkan |
lib.rs | inkan |
version | 0.0.3 |
source | src |
created_at | 2023-04-23 08:10:44.068418 |
updated_at | 2023-06-05 09:44:30.906674 |
description | git cli containing templates & utilities. |
homepage | https://github.com/xsv24/inkan |
repository | https://github.com/xsv24/inkan |
max_upload_size | |
id | 846414 |
size | 228,429 |
Use this CLI to help format your git commit messages consistently with less effort via pre-provided templates! ๐คฉ
There are two default templates provided:
You can also create your own Custom Templates by following the Custom Template Guide.
inkan config set default
- โจ feat Adds new functionality.
- ๐ bug Fix that resolves an unintended issue.
- ๐งช test Improves or adds existing tests related to the code base.
- ๐งน refactor Improvement of code/structure without adding new functionality.
- ๐ docs Change or update to documentation (i.e README's, code comments, etc).
- ๐ฆ deps Version update or migration to a new dependency.
- โ ๏ธ break Breaking change that may break a downstream application or service.
- ๐ chore Regular code maintenance.
- ๐ญ ci Changes to CI configuration files and scripts.
[{ticket_num}] โ {message}
ticket_num
ticket / issue number related to the branch.message
commit message.inkan config set conventional
- โจ feat Adds new functionality.
- โ fix Fix that resolves an unintended issue (i.e. bug).
- ๐งช test Improves or adds existing tests related to the code base.
- ๐งน refactor Improvement of code/structure without adding new functionality.
- ๐ docs Change or update to documentation (i.e README's, code comments, etc).
- ๐จ build Changes that affect the build system or external dependencies.
- ๐ chore Regular code maintenance.
- ๐ญ ci Changes to CI configuration files and scripts.
- ๐ perf Improvement of code performance (i.e. speed, memory, etc).
- ๐บ style Formatting updates, lint fixes, etc. (i.e. missing semi colons).
{type}({scope}): {message}
ticket_num
ticket / issuer number related to the branch.message
subject message.scope
Short description of a section of the codebase the commit relates to.Homebrew coming soon ๐ค
Install the latest version:
curl -sS https://raw.githubusercontent.com/xsv24/inkan/main/scripts/install.sh | sh
Depending on your setup you may need to run the script with sudo
.
curl -sS https://raw.githubusercontent.com/xsv24/inkan/main/scripts/install.sh | sudo sh -s - -b /usr/local/bin
Package managers coming soon ๐ค
Install the latest version:
curl -sS https://raw.githubusercontent.com/xsv24/inkan/main/scripts/install.sh | sh
Coming soon ๐ค
inkan --help
# Checkout a new branch & add optional context params.
inkan checkout fix-parser
--ticket TICKET-123 \
--scope parser \
--link "http://ticket-manager/TICKET-123"
# Select a registered config containing templates to use.
inkan config set
# View currently available templates on chosen config.
inkan templates
# Commit some changes.
inkan commit bug -m "Fix up parser"
inkan commit chore
Creates a new branch or checks out an existing branch attaching the following optional context parameters for use in future commit templates.
ticket_num
Issue number related to the branch.link
Link to to the related issue.scope
Short description of a section of the codebase the commit relates to.When it's time to commit your changes any provided context params (i.e.ticket_number
) will be injected into each commit message for you automatically! ๐ It does this by a simple template string injection.
Examples:
inkan checkout my-branch --ticket TICKET-123
inkan checkout my-branch \
-t TICKET-123 \
--scope parser \
--link "http://ticket-manager/TICKET-123"
Most likely your ticket / issue will only have one branch associated to it. In this case you can use the following shorthand ๐
inkan checkout TICKET-123
The checkout command also makes use of a simple customizable template which can be configured within a template config that defaults to the following format.
branch:
content: {branch_name}-{ticket_num}
Create or update context params linked to the current checked out branch.
ticket_num
Issue number related to the branch.link
Link to to the related issue.scope
Short description of a section of the codebase the commit relates to.This is handy if you forgot to add context via the inkan
checkout command or if you want to update the context for future commits.
When it's time to commit your changes any provided context params (i.e.ticket_number
) will be injected into each commit message for you automatically! ๐ It does this by a simple template string injection.
inkan context \
--ticket TICKET-123 \
--scope parser \
--link "http://ticket-manager/TICKET-123"
Commits any staged changes and builds an editable commit message by injecting any context set parameters from the checkout or context commands into a chosen template (i.e. bug
).
inkan commit bug
Example template:
[{ticket_num}] ๐ {message}
โ[TICKET-123] ๐ Fix
Lists currently available commit templates. To add your own, refer to the Custom Commit Template guide.
inkan templates
- bug | Fix that resolves an unintended issue
- ...
The default template will be set as active initially but you can switch between the provided configurations and any added custom templates via the config set
command.
inkan config set
โน๏ธ It's not recommend to alter the default template files as they could be replaced / updated on new releases.
Instead, copy & paste the desired default template, save it somewhere, and add it to the CLI as shown in the persist configuration guide.
Creating your own templates can be done simply by creating your own configuration file .inkan.yml.
Here's an example of a custom template called custom
version: 1
commit:
templates:
custom:
description: My custom commit template ๐ธ
content: |
{ticket_num} ๐ค {message}
Your custom configuration / templates can be provided to the CLI in one of the following ways:
--config
option..inkan.yml
config file within your git repositories root directory.config add
subcommand as highlighted in the persist configuration guide.Persisting / linking your own config file can be done by providing the file path to your config file and a reference name.
inkan config add $CONFIG_NAME $CONFIG_PATH
You can add multiple config files and switch between them via set
command.
inkan config set $CONFIG_NAME
or
# Select prompt for available configurations
inkan config set
> ? Configuration:
โ default
conventional
custom
To ensure your template has been loaded simply run the command below ๐ to see a list of the currently configured templates.
inkan templates
- custom | My custom commit template ๐ธ
- ...
Then when your ready to commit your changes use your custom template and your done! ๐ช
inkan commit custom \
--ticket TICKET-123 \
--message "Dang!"
[TICKET-123] ๐ค Dang!