added oh-my-ssh back as raw code, not as a submodule.
This commit is contained in:
parent
23fe3ee6d5
commit
f663947bfc
1195 changed files with 126994 additions and 0 deletions
44
.zsh/oh-my-zsh/plugins/git-commit/README.md
Normal file
44
.zsh/oh-my-zsh/plugins/git-commit/README.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# git-commit plugin
|
||||
|
||||
The git-commit plugin adds several git subcommands for
|
||||
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
|
||||
|
||||
To use it, add `git-commit` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... git-commit)
|
||||
```
|
||||
|
||||
## Syntax
|
||||
|
||||
```zsh
|
||||
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
|
||||
```
|
||||
|
||||
Where `type` is one of the following:
|
||||
|
||||
- `build`
|
||||
- `chore`
|
||||
- `ci`
|
||||
- `docs`
|
||||
- `feat`
|
||||
- `fix`
|
||||
- `perf`
|
||||
- `refactor`
|
||||
- `rev`
|
||||
- `style`
|
||||
- `test`
|
||||
- `wip`
|
||||
|
||||
> NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the
|
||||
> git command of the same name. It will still generate a commit message in the format
|
||||
> `revert: <message>`
|
||||
|
||||
## Examples
|
||||
|
||||
| Git subcommand | Command |
|
||||
| --------------------------------------------- | ---------------------------------------------------- |
|
||||
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
|
||||
| `git wip "work in progress"` | `git commit -m "work in progress"` |
|
||||
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
|
||||
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-build
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-build
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-chore
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-chore
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-ci
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-ci
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-docs
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-docs
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-feat
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-feat
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-fix
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-fix
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-perf
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-perf
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-refactor
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-refactor
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-rev
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-rev
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-style
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-style
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-test
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-test
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-wip
Symbolic link
1
.zsh/oh-my-zsh/plugins/git-commit/git-commands/git-wip
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
./omz_git_commit
|
||||
38
.zsh/oh-my-zsh/plugins/git-commit/git-commands/omz_git_commit
Executable file
38
.zsh/oh-my-zsh/plugins/git-commit/git-commands/omz_git_commit
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
_omz_git_commit() {
|
||||
0=${(%):-%x}
|
||||
if [[ "$0" != */git-* ]]; then
|
||||
echo >&2 "Expecting command named git-foo. Got '$0'."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local _type="${0##*/git-}"
|
||||
# The subcommand is shortened to avoid Git's built-in revert command.
|
||||
if [[ "$_type" == rev ]]; then
|
||||
_type=revert
|
||||
fi
|
||||
local _scope _attention _message
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-s | --scope )
|
||||
if [ -z $2 ]; then
|
||||
echo >&2 "Missing scope!"
|
||||
return 1
|
||||
fi
|
||||
_scope="$2"
|
||||
shift 2
|
||||
;;
|
||||
-a | --attention )
|
||||
_attention="!"
|
||||
shift 1
|
||||
;;
|
||||
* )
|
||||
_message="${_message} $1"
|
||||
shift 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}"
|
||||
}
|
||||
_omz_git_commit "$@"
|
||||
45
.zsh/oh-my-zsh/plugins/git-commit/git-commit.plugin.zsh
Normal file
45
.zsh/oh-my-zsh/plugins/git-commit/git-commit.plugin.zsh
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Add git-commit commands directory to path
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
path=("${0:a:h}/git-commands" $path)
|
||||
|
||||
# Append completions for custom git commands
|
||||
() {
|
||||
local -a git_user_commands
|
||||
zstyle -a ':completion:*:*:git:*' user-commands 'git_user_commands' \
|
||||
|| git_user_commands=()
|
||||
git_user_commands+=(
|
||||
build:'Commit with a message indicating a build' \
|
||||
chore:'Commit with a message indicating a chore' \
|
||||
ci:'Commit with a message indicating a CI change' \
|
||||
docs:'Commit with a message indicating an update to the documentation' \
|
||||
feat:'Commit with a message indicating a feature' \
|
||||
fix:'Commit with a message indicating a fix' \
|
||||
perf:'Commit with a message indicating a performance enhancement' \
|
||||
refactor:'Commit with a message indicating a refactor' \
|
||||
rev:'Commit with a message indicating a revert' \
|
||||
style:'Commit with a message indicating a style change' \
|
||||
test:'Commit with a message indicating updates to tests' \
|
||||
wip:'Commit with a message indicating a work in progress'
|
||||
)
|
||||
zstyle ':completion:*:*:git:*' user-commands "${git_user_commands[@]}"
|
||||
}
|
||||
|
||||
# Clean up aliases from the prior implementation of git-commit. Keep this migration
|
||||
# for users upgrading from versions that still wrote aliases to .gitconfig.
|
||||
() {
|
||||
git config --global --get oh-my-zsh.git-commit-alias &> /dev/null || return 0
|
||||
local -a old_git_aliases=(
|
||||
'build' 'chore' 'ci'
|
||||
'docs' 'feat' 'fix'
|
||||
'perf' 'refactor' 'rev'
|
||||
'style' 'test' 'wip'
|
||||
)
|
||||
local git_alias
|
||||
for git_alias in $old_git_aliases; do
|
||||
if [[ "$(git config --global --get alias.$git_alias | tr '\n' ' ')" == "!a() { local _scope _attention _message"* ]]; then
|
||||
git config --global --unset alias.$git_alias
|
||||
fi
|
||||
done
|
||||
git config --global --unset oh-my-zsh.git-commit-alias
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue