firefish/neko/update/utils

28 lines
479 B
Text
Raw Normal View History

color() {
if [ -t 1 ]; then
tput setaf "${1:-7}"
fi
}
say() {
color 5 # magenta
printf "( ^-^) < %s\n" "$1"
color
}
running() {
color 3 # yellow
printf "[running] \$ %s\n" "$1"
color
}
br() {
printf "\\n"
}
version() {
COMMIT_DATE=$(git show --no-patch --pretty="%cs" FETCH_HEAD | sed -e "s/-//g" | cut -c 3-)
COMMIT_HASH_INITIAL=$(printf "%s" "$(git rev-parse FETCH_HEAD)" | cut -c 1)
printf "%s.%s" "${COMMIT_DATE}" "${COMMIT_HASH_INITIAL}"
}