2023-11-12 05:31:20 +09:00
|
|
|
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"
|
2023-11-12 05:31:20 +09:00
|
|
|
color
|
|
|
|
}
|
|
|
|
|
2024-01-05 13:18:25 +09:00
|
|
|
sadsay() {
|
|
|
|
color 5 # magenta
|
|
|
|
printf '( T-T) < %s\n' "$1"
|
|
|
|
color
|
|
|
|
}
|
|
|
|
|
2023-11-18 16:37:55 +09:00
|
|
|
run() {
|
2023-11-12 05:31:20 +09:00
|
|
|
color 3 # yellow
|
2023-11-21 03:24:54 +09:00
|
|
|
printf '[running] $ %s\n' "$1"
|
2023-11-12 05:31:20 +09:00
|
|
|
color
|
2023-11-18 16:37:55 +09:00
|
|
|
/bin/sh -c "$1"
|
2023-11-12 05:31:20 +09:00
|
|
|
}
|
2023-11-14 23:04:56 +09:00
|
|
|
|
|
|
|
br() {
|
2023-11-21 03:43:39 +09:00
|
|
|
printf '\n'
|
2023-11-14 23:04:56 +09:00
|
|
|
}
|
2023-11-14 23:54:37 +09:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-11-14 23:54:37 +09:00
|
|
|
version() {
|
2023-11-27 18:31:21 +09:00
|
|
|
UPSTREAM_VERSION=$(pnpm pkg get version | sed -e 's/"//g')
|
2023-11-21 21:33:56 +09:00
|
|
|
COMMIT_DATE=$(git show --no-patch --pretty='%cs' FETCH_HEAD | sed -e 's/-//g' | cut -c 3-)
|
2024-01-07 16:50:21 +09:00
|
|
|
COMMIT_HASH_INITIAL=$(printf '%s' "$(git rev-parse FETCH_HEAD)" | cut -c 1-2)
|
2023-11-27 18:31:21 +09:00
|
|
|
printf '%s+neko:%s.%s' "${UPSTREAM_VERSION}" "${COMMIT_DATE}" "${COMMIT_HASH_INITIAL}"
|
2023-11-14 23:54:37 +09:00
|
|
|
}
|
2023-12-27 21:41:09 +09:00
|
|
|
|
|
|
|
version_ci() {
|
|
|
|
UPSTREAM_VERSION=$(grep '"version":' package.json | cut -d '"' -f 4)
|
|
|
|
COMMIT_DATE=$(git show --no-patch --pretty='%cs' HEAD | sed -e 's/-//g' | cut -c 3-)
|
2024-01-07 16:50:21 +09:00
|
|
|
COMMIT_HASH_INITIAL=$(printf '%s' "$(git rev-parse HEAD)" | cut -c 1-2)
|
2023-12-27 21:41:09 +09:00
|
|
|
printf '%s+neko:%s.%s' "${UPSTREAM_VERSION}" "${COMMIT_DATE}" "${COMMIT_HASH_INITIAL}"
|
|
|
|
}
|