-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·23 lines (18 loc) · 735 Bytes
/
init.sh
File metadata and controls
executable file
·23 lines (18 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
die () {
echo >&2 "$@"
exit 1
}
defaultName=$(git remote -v | cut -d':' -f 2 | cut -d'.' -f 1 | uniq)
read -p "Repo name (${defaultName}): " name
test -z "$name" && name=${defaultName}
defaultProject=${defaultName#*/}
read -p "Project name (${defaultProject}}: " project
test -z "project" && project=${defaultProject}
read -p "Executable name: " binary
test -z "binary" && {
die "You must specify executable name"
}
find . -type f -not -path "./vendor/*" -not -path "./.git/*" -not -path "./init.sh" -exec sed -i "s|bartoszmajsak/template-golang|${name}|g" '{}' \;
sed -i "s|PROJECT_NAME:=template-golang|PROJECT_NAME:=${project}|g" Makefile
sed -i "s|BINARY_NAME:=binary|BINARY_NAME:=${binary}|g" Makefile