-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathfill_template.sh
More file actions
executable file
·36 lines (28 loc) · 852 Bytes
/
fill_template.sh
File metadata and controls
executable file
·36 lines (28 loc) · 852 Bytes
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
34
35
36
#!/usr/bin/env sh
set -e
echo "To fill the template tell me your egui project crate name: "
read crate
echo "To fill the template tell me your name (for author in Cargo.toml): "
read name
echo "To fill the template tell me your e-mail address (also for Cargo.toml): "
read email
echo "Patching files..."
# Determine the correct sed syntax based on OS
if [ "$(uname)" = "Darwin" ]; then
# macOS sed
sed_inplace() {
sed -i '' "$@"
}
else
# GNU sed (Linux)
sed_inplace() {
sed -i "$@"
}
fi
sed_inplace "s/eframe_template/$crate/g" Cargo.toml
sed_inplace "s/eframe_template/$crate/g" src/main.rs
sed_inplace "s/eframe template/$crate/g" index.html
sed_inplace "s/eframe_template/$crate/g" assets/sw.js
sed_inplace "s/Emil Ernerfeldt/$name/g" Cargo.toml
sed_inplace "s/emil.ernerfeldt@gmail.com/$email/g" Cargo.toml
echo "Done."