-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.sh
executable file
·33 lines (24 loc) · 1.01 KB
/
template.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -e
template="go-faster/template"
name="${PWD##*/}"
repo="go-faster/${name}"
pkg="github.com/${repo}"
head="$(git rev-list --max-parents=0 HEAD)"
set -e
# update all references to the template repo
grep -rl "${template}" . | xargs sed -i "s|${template}|${repo}|g"
# update latest commit
commit="a65086111716ab748f562ce12cef7d8c01f91c92"
grep -rl "${commit}" . | xargs sed -i "s|${commit}|${head}|g"
# generate new root package
rm pkg.go
printf "// Package %s is a new package.\npackage %s\n" "${name}" "${name}" > "${name}.go"
# generate new README.md
rm README.md
readme="# ${name} [](https://pkg.go.dev/${pkg}#section-documentation) [](https://codecov.io/gh/${repo}) [](https://go-faster.org/docs/projects/status#experimental)
Work in progress."
echo "${readme}" > README.md
# cleanup
rm template.sh
rm -rf .idea