✨ Add gitmoji-fuzzy-hook
This commit is contained in:
parent
b2d9c64f1f
commit
101648b52b
4 changed files with 40 additions and 3 deletions
|
@ -3,6 +3,7 @@
|
||||||
[core]
|
[core]
|
||||||
attributesFile = ~/dotfiles/git/.gitattributes
|
attributesFile = ~/dotfiles/git/.gitattributes
|
||||||
excludesFile = ~/dotfiles/git/.gitignore
|
excludesFile = ~/dotfiles/git/.gitignore
|
||||||
|
hooksPath = ~/dotfiles/git/hooks
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
# Do not guess the user's identity.
|
# Do not guess the user's identity.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Title: Summary, imperative, start upper case, don't end with a period
|
|
||||||
# No more than 50 chars. #### 50 chars is here: #
|
|
||||||
|
|
||||||
|
# No more than 50 chars. #### 50 chars is here: #
|
||||||
|
# Title: Summary, imperative, start upper case, don't end with a period
|
||||||
# Remember blank line between title and body.
|
# Remember blank line between title and body.
|
||||||
|
|
||||||
# Body: Explain *what* and *why* (not *how*).
|
# Body: Explain *what* and *why* (not *how*).
|
||||||
|
|
33
git/hooks/prepare-commit-msg
Executable file
33
git/hooks/prepare-commit-msg
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
###############################################################################
|
||||||
|
## Title: gitmoji-fuzzy-hook-init
|
||||||
|
## Brief: It opens a fuzzy searcher with gitmojis, to allow the git commit
|
||||||
|
## caller to select one. For git commit visual mode
|
||||||
|
## it adds a description of the selected emoji.
|
||||||
|
## Args:
|
||||||
|
## $1: File of the commit message
|
||||||
|
## $2: Commit type
|
||||||
|
## $3: Commit Hash
|
||||||
|
##
|
||||||
|
## Returns:
|
||||||
|
## Prepends a selectable gitmoji to the git commit message.
|
||||||
|
##
|
||||||
|
## Source: https://gitlab.com/raabf/gitmoji-fuzzy-hook
|
||||||
|
## Author: Fabian Raab <fabian@raab.link>
|
||||||
|
## Dependencies: gitmoji-fuzzy-hook
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
[ -t 1 ] # checks if this script is called from a terminal
|
||||||
|
emoji="$(/Users/marley/.local/share/gitmoji-fuzzy-hook/bin/gitmoji-fuzzy-hook-exec.sh $? $@)"
|
||||||
|
|
||||||
|
msg_file="$1"
|
||||||
|
msg="$(cat "$msg_file")"
|
||||||
|
|
||||||
|
# Do here whatever you want with the commit message before prepending the emoji
|
||||||
|
# to it and writing the message to the commit file.
|
||||||
|
|
||||||
|
if [ ! -z "${emoji}" ]; then # surpress the space if there is no emoji
|
||||||
|
msg="${emoji} ${msg}"
|
||||||
|
fi
|
||||||
|
echo -e "$msg" > "$msg_file"
|
||||||
|
|
|
@ -8,4 +8,7 @@ source "$DOT/homebrew/brew_utils.fish"
|
||||||
print_subtitle Git
|
print_subtitle Git
|
||||||
|
|
||||||
brew_install "Github CLI" gh
|
brew_install "Github CLI" gh
|
||||||
brew_install Gitmoji gitmoji
|
execute \
|
||||||
|
"git clone https://gitlab.com/raabf/gitmoji-fuzzy-hook.git ~/.local/share/gitmoji-fuzzy-hook && \
|
||||||
|
ln -f -s ~/.local/share/gitmoji-fuzzy-hook/bin/gitmoji-fuzzy-hook-init.sh $HOME/bin/gitmoji-fuzzy-hook-init" \
|
||||||
|
gitmoji-fuzzy-hook
|
||||||
|
|
Loading…
Reference in a new issue