blob: c64168805690e1b9dd652cec1c492c1bd895524c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/sh
set -eu
parent_dir=$(cd "$(dirname "${0}")" && pwd)
cd "${parent_dir}" || exit 1
basedir=$(basename "${parent_dir}")
author=$(git show -s --format='%ae' | cut -d '@' -f 1)
branch=$(git branch --show-current)
gitlab_id=$(printf '%s' "${branch}" | cut -d '-' -f 1)
file="${branch}"
if test -e "${file}"; then
printf 'Nothing done. File already exists: %s\n' "${basedir}/${file}"
exit 1
fi
content=$(cat .template)
content="${content//author/${author}}"
content="${content//#0000/#${gitlab_id}}"
printf '%s\n' "${content}" > "${file}"
|