File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Pre-commit plugin
22
33This plugin adds aliases for common commands of [ pre-commit] ( https://pre-commit.com/ ) .
4+ It also supports [ prek] ( https://github.com/prek/prek ) as a drop-in replacement.
5+ If ` prek ` is available, it will be used; otherwise, ` pre-commit ` is used as fallback.
46
57To use this plugin, add it to the plugins array in your zshrc file:
68
@@ -10,10 +12,11 @@ plugins=(... pre-commit)
1012
1113## Aliases
1214
13- | Alias | Command | Description |
14- | ------- | -------------------------------------- | ------------------------------------------------------ |
15- | prc | ` pre-commit ` | The ` pre-commit ` command |
16- | prcau | ` pre-commit autoupdate ` | Update hooks automatically |
17- | prcr | ` pre-commit run ` | The ` pre-commit run ` command |
18- | prcra | ` pre-commit run --all-files ` | Run pre-commit hooks on all files |
19- | prcrf | ` pre-commit run --files ` | Run pre-commit hooks on a given list of files |
15+ | Alias | Command | Description |
16+ | ----- | ------------------------------------------------------ | --------------------------------------------- |
17+ | prc | ` prek ` or ` pre-commit ` | The pre-commit command |
18+ | prcau | ` prek auto-update ` or ` pre-commit autoupdate ` | Update hooks automatically |
19+ | prcr | ` prek run ` or ` pre-commit run ` | The pre-commit run command |
20+ | prcra | ` prek run --all-files ` or ` pre-commit run --all-files ` | Run pre-commit hooks on all files |
21+ | prcrf | ` prek run --files ` or ` pre-commit run --files ` | Run pre-commit hooks on a given list of files |
22+
Original file line number Diff line number Diff line change 1- # Aliases for pre-commit
2- alias prc=' pre-commit'
1+ # Aliases for pre-commit (uses prek if available, else pre-commit)
2+ if command -v prek & > /dev/null; then
3+ _prc_cmd=' prek'
4+ _prc_autoupdate=' auto-update'
5+ else
6+ _prc_cmd=' pre-commit'
7+ _prc_autoupdate=' autoupdate'
8+ fi
39
4- alias prcau=' pre-commit autoupdate'
10+ alias prc=" $_prc_cmd "
11+
12+ alias prcau=" $_prc_cmd $_prc_autoupdate "
13+
14+ alias prcr=" $_prc_cmd run"
15+ alias prcra=" $_prc_cmd run --all-files"
16+ alias prcrf=" $_prc_cmd run --files"
517
6- alias prcr=' pre-commit run'
7- alias prcra=' pre-commit run --all-files'
8- alias prcrf=' pre-commit run --files'
You can’t perform that action at this time.
0 commit comments