1
0
Fork 1
mirror of https://example.com synced 2024-11-22 22:06:40 +09:00
firefish/neko/update/utils

53 lines
775 B
Text

# shellcheck disable=SC2148
color() {
if [ -t 1 ]; then
tput setaf "${1:-7}"
fi
}
say() {
color 5 # magenta
printf '( ^-^) < %s\n' "$1"
color
}
sadsay() {
color 5 # magenta
printf '( T-T) < %s\n' "$1"
color
}
run() {
color 3 # yellow
printf '[running] $ %s\n' "$1"
color
/bin/sh -c "$1"
}
br() {
printf '\n'
}
contains() {
target="$1"
shift
for item in "$@"; do
if [ "${item}" = "${target}" ]; then
return 0 # found
fi
done
return 1 # not found
}
version() {
COMMIT_DATE=$(git show --no-patch --pretty='%cs' FETCH_HEAD | sed -e 's/-//g')
printf '%s+neko' "${COMMIT_DATE}"
}
version_ci() {
COMMIT_DATE=$(git show --no-patch --pretty='%cs' HEAD | sed -e 's/-//g')
printf '%s+neko' "${COMMIT_DATE}"
}