firefish/neko/update/utils

54 lines
775 B
Text
Raw Permalink Normal View History

2024-01-14 20:15:05 +09:00
# shellcheck disable=SC2148
color() {
if [ -t 1 ]; then
tput setaf "${1:-7}"
fi
}
say() {
color 5 # magenta
2023-11-18 16:37:55 +09:00
printf '( ^-^) < %s\n' "$1"
color
}
sadsay() {
color 5 # magenta
printf '( T-T) < %s\n' "$1"
color
}
2023-11-18 16:37:55 +09:00
run() {
color 3 # yellow
2023-11-21 03:24:54 +09:00
printf '[running] $ %s\n' "$1"
color
2023-11-18 16:37:55 +09:00
/bin/sh -c "$1"
}
br() {
2023-11-21 03:43:39 +09:00
printf '\n'
}
2024-01-09 10:23:23 +09:00
contains() {
target="$1"
shift
for item in "$@"; do
if [ "${item}" = "${target}" ]; then
return 0 # found
fi
done
return 1 # not found
}
version() {
2024-02-22 06:42:21 +09:00
COMMIT_DATE=$(git show --no-patch --pretty='%cs' FETCH_HEAD | sed -e 's/-//g')
printf '%s+neko' "${COMMIT_DATE}"
}
version_ci() {
2024-02-22 06:42:21 +09:00
COMMIT_DATE=$(git show --no-patch --pretty='%cs' HEAD | sed -e 's/-//g')
printf '%s+neko' "${COMMIT_DATE}"
}