Skip to content

Commit

Permalink
feat(scaffold): support arg -v
Browse files Browse the repository at this point in the history
  • Loading branch information
taccisum committed Jul 25, 2019
1 parent 56349a8 commit ac98029
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions generators/app/templates/README.tmpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ $ java -jar ./${artifactId}-provider/target/${artifactId}-provider-{version}.jar
#### 容器启动

```bash
$ sh start-code.sh [-bl] [-p port]
$ sh start-code.sh [-bl] [-p port] [-v version]
```

- -b: 是否从本地构建镜像
- -l: 是否在启动后输出容器日志
- -p: 指定容器映射端口号
- -p: 指定容器映射端口号(默认8080)
- -v: 指定构建镜像的版本号(默认1.0.0)

如果需要自定义启动命令,可以自行修改[`run.sh`](./run.sh)

Expand Down
9 changes: 6 additions & 3 deletions generators/app/templates/start-code.tmpl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ source ./common.sh
output_log=
build=
port=8080
version='1.0.0'

while getopts lbp: opt
while getopts lbp:v: opt
do
case $opt in
l)
Expand All @@ -20,8 +21,11 @@ do
p)
port=$OPTARG
;;
v)
version=$OPTARG
;;
?)
error "Usage: %s: [-b] [-l] [-p] args\n" $0
error "Usage: %s: [-b] [-l] [-p port] [-v version] args\n" $0
exit 2
;;
esac
Expand All @@ -30,7 +34,6 @@ done

#----------------- 启动逻辑 start -----------------#
project_name='${artifactId}'
version='1.0.0'

proj_home=$PWD # the project root dir
img_output=$project_name:v$version # output image tag
Expand Down

0 comments on commit ac98029

Please sign in to comment.