feat: clean terminals now open with logo
This commit is contained in:
@ -6,6 +6,45 @@ println() {
|
||||
printfe "%s\n" $color "$1"
|
||||
}
|
||||
|
||||
logo() {
|
||||
tput setaf 2
|
||||
cat ~/dotfiles/bin/resources/logo.txt
|
||||
println " " "cyan"
|
||||
tput sgr0
|
||||
|
||||
continue_eitherway=$1
|
||||
|
||||
# Print if repo is dirty and the count of untracked files, modified files and staged files
|
||||
if [[ $(git -C ~/dotfiles status --porcelain) ]]; then
|
||||
printfe "%s" "yellow" "dotfiles repo is dirty "
|
||||
printfe "%s" "red" "[$(git -C ~/dotfiles status --porcelain | grep -c '^??')] untracked "
|
||||
printfe "%s" "yellow" "[$(git -C ~/dotfiles status --porcelain | grep -c '^ M')] modified "
|
||||
printfe "%s" "green" "[$(git -C ~/dotfiles status --porcelain | grep -c '^M ')] staged "
|
||||
fi
|
||||
|
||||
printfe "%s" "blue" "[$(git -C ~/dotfiles rev-parse --short HEAD)] "
|
||||
if [[ $(git -C ~/dotfiles log origin/master..HEAD) ]]; then
|
||||
printfe "%s" "yellow" "[!] You have $(git -C ~/dotfiles log origin/master..HEAD --oneline | wc -l | tr -d ' ') commit(s) to push"
|
||||
fi
|
||||
println "" "normal"
|
||||
|
||||
if [[ $continue_eitherway == "continue" ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ $(git -C ~/dotfiles status --porcelain) ]]; then
|
||||
# Continue?
|
||||
printfe "%s" "red" "Continue anyway? [y/N] "
|
||||
read -k 1
|
||||
|
||||
if [[ $REPLY != "y" ]]; then
|
||||
println "" "normal"
|
||||
exit 0
|
||||
fi
|
||||
println "" "normal"
|
||||
println "" "normal"
|
||||
fi
|
||||
}
|
||||
|
||||
# print colored with printf (args: format, color, message ...)
|
||||
printfe() {
|
||||
format=$1
|
||||
|
Reference in New Issue
Block a user