-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathexample.sh
executable file
·33 lines (28 loc) · 965 Bytes
/
example.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
#!/usr/bin/env bash
# Files like this:
# ```
# + generator
# - templates
# - tto.conf
# - example.sh
# ```
if [[ $(whereis tto) = 'tto:' ]]; then
echo '未安装tto客户端,请运行安装命令: curl -L https://raw.githubusercontent.com/ixre/tto/master/install | sh'
fi
TABLE_KEYWORD=""
CONF_DIR=$(dirname "$0")
tto -conf "$CONF_DIR"/tto.conf -t "$CONF_DIR"/templates -o output \
-model '' \
-pkg '' \
-excludes tmp_ \
-table "${TABLE_KEYWORD}" \
-clean
# Replace generator description part of code file
# find output/spring -name "*.java" -print0 | xargs -0 sed -i ':label;N;s/This.*Copy/Copy/g;b label'
# Replace package
# find output/spring -name "*.java" -print0 | xargs -0 sed -i 's/net.fze/com.pkg/g'
# Replace type
# find output/java -name "*.java" -print0 | xargs -0 sed -i 's/ int / Integer /g'
# copy files to project folder
# find ./src -path "*/entity" -print0 | xargs -0 cp output/spring/src/main/java/com/github/tto/entity/*
exit 0;