This commit is contained in:
Jonas Forsberg
2021-11-12 12:21:38 +01:00
parent e67e4a13b5
commit c5d16114b8
2 changed files with 50 additions and 1 deletions

31
.functions/dotfiles.sh Normal file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
function dotf(){
/usr/bin/git --git-dir="$HOME"/.dotfiles --work-tree="$HOME" "$@"
}
dotfiles_status(){
case $1 in
check_error)
result="$(/usr/bin/git --git-dir="$HOME"/.dotfiles --work-tree="$HOME" status --short 2> /dev/null)"
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
echo YES
fi
;;
check_status)
result="$(/usr/bin/git --git-dir="$HOME"/.dotfiles --work-tree="$HOME" status --short 2> /dev/null)"
if [[ -n "$result" ]]; then
echo YES
fi
;;
check_push)
result="$(/usr/bin/git --git-dir="$HOME"/.dotfiles --work-tree="$HOME" status --short 2> /dev/null)"
if [[ -z "$result" ]]; then
result="$(/usr/bin/git --git-dir="$HOME"/.dotfiles --work-tree="$HOME" cherry -v )"
if [[ -n "$result" ]]; then
echo YES
fi
fi
;;
esac
}