Skip to content

Commit

Permalink
🚸 Fix #8, don't mkdir ~/.gitmoji
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Jan 4, 2024
1 parent d1306d2 commit 4dd0c69
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions bin/gitmoji.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env -S jq -jf
# https://github.com/carloscuesta/gitmoji-cli/issues/1246
.[] | "s=\(.code)=\(.emoji)=g;"
3 changes: 0 additions & 3 deletions functions/main.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
(($+commands[grc])) || grc() {eval ${@[2,-1]}}
(($+commands[jq])) || jq() {echo ';'}

mkdir -p ~/.gitmoji
touch ~/.gitmoji/gitmojis.json

# dictionary $ZINIT cannot be passed
PLUGINS_DIR=${ZINIT[PLUGINS_DIR]}

Expand Down
4 changes: 2 additions & 2 deletions sources/git-checkout.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ case $group in
;;
'recent commit object name')
git log --color=always $word |
perl -pe' '$(jq -j '.[] | "s=\(.code)=\(.emoji)=g;"' ~/.gitmoji/gitmojis.json) |
perl -pe' '$([ -f ~/.gitmoji/gitmojis.json ] && ${src:h:h}/bin/gitmoji.jq ~/.gitmoji/gitmojis.json || :) |
delta
;;
*)
git log --color=always $word |
perl -pe' '$(jq -j '.[] | "s=\(.code)=\(.emoji)=g;"' ~/.gitmoji/gitmojis.json)
perl -pe' '$([ -f ~/.gitmoji/gitmojis.json ] && ${src:h:h}/bin/gitmoji.jq ~/.gitmoji/gitmojis.json || :)
;;
esac
2 changes: 1 addition & 1 deletion sources/git-log.zsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# :fzf-tab:complete:git-log:argument-1
git log --color=always $word |
perl -pe' '$(jq -j '.[] | "s=\(.code)=\(.emoji)=g;"' ~/.gitmoji/gitmojis.json)
perl -pe' '$([ -f ~/.gitmoji/gitmojis.json ] && ${src:h:h}/bin/gitmoji.jq ~/.gitmoji/gitmojis.json || :)
4 changes: 2 additions & 2 deletions sources/git-reflog.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
case $group in
command)
git reflog --color=always |
perl -pe' '$(jq -j '.[] | "s=\(.code)=\(.emoji)=g;"' ~/.gitmoji/gitmojis.json)
perl -pe' '$([ -f ~/.gitmoji/gitmojis.json ] && ${src:h:h}/bin/gitmoji.jq ~/.gitmoji/gitmojis.json || :)
;;
reference)
git reflog --color=always $word |
perl -pe' '$(jq -j '.[] | "s=\(.code)=\(.emoji)=g;"' ~/.gitmoji/gitmojis.json)
perl -pe' '$([ -f ~/.gitmoji/gitmojis.json ] && ${src:h:h}/bin/gitmoji.jq ~/.gitmoji/gitmojis.json || :)
;;
esac

0 comments on commit 4dd0c69

Please sign in to comment.