Enhance the tool with a --init flag to automate setting up the commit-msg hook, including:
- Git Directory Validation – Check if the tool is run inside a valid Git repository.
- Existing Hook Detection – If a commit-msg hook already exists, prompt the user to modify or replace it.
- Automatic Hook Setup – If no existing hook, create one linking to the linter.
- Configurable Options – Allow users to choose custom configurations during setup or by passing
--config flag.
- Helpful Messages – Provide clear output on setup success or failure.
More info:
To check linting of the current commit message the commit-msg hook should be modified with the following:
#!/bin/sh
commit_msg_file="$1"
# Run the linter with the commit message file
git-commit-linter lint-file "$commit_msg_file" || exit 1
Currently this needs to be modified manually, with this new implementation this configuration will be automated.
Example Command: git-commit-linter --init
Enhance the tool with a --init flag to automate setting up the commit-msg hook, including:
--configflag.More info:
To check linting of the current commit message the commit-msg hook should be modified with the following:
Currently this needs to be modified manually, with this new implementation this configuration will be automated.
Example Command:
git-commit-linter --init