Skip to content

Commit

Permalink
fix: incorrect comment scan
Browse files Browse the repository at this point in the history
chore: update readme
  • Loading branch information
shuhangli committed Jun 1, 2023
1 parent bdaabf6 commit db98d70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions docs/README.CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ layoutRepository=https://gitee.com/go-kratos/kratos-layout.git

## pb
* 在pb文件添加注释//kratos:pb
* (optional) 添加注释depends如:
* (optional) 添加注释depends以添加protoc proto_path参数,如:
> //depends:./third_party
* (optional) 添加注释additional以添加额外的protoc参数,如:
> //additional:--validate_out=lang=go,paths=source_relative:./
## 3. biz/service/data模板

TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ private fun additionalArgs(file: PsiFile): HashSet<String>{
val dependsComments = file.children.filter { v -> v is PsiComment && v.text.contains("additional:") }
for (comment in dependsComments) {
val text = comment.text
val match = Regex("depends:(.+)").find(text)
var additional = match?.groupValues?.find { m -> !m.contains("depends") } ?: ""

val match = Regex("additional:(.+)").find(text)
val additional = match?.groupValues?.find { m -> !m.contains("additional") } ?: ""
if (additional.isNotEmpty()) {
result.add(additional)
}
Expand All @@ -82,8 +81,8 @@ fun genPbTask(file: PsiFile): KratosTask? {
cmds.addAll(otherPaths)
cmds.add("--proto_path=${DirHelper.join(project.basePath!!, *parentPath)}")
cmds.add("--go_out=paths=source_relative:${DirHelper.join(project.basePath!!, *parentPath)}")
cmds.add(DirHelper.join(project.basePath!!, *parentPath, file.name))
cmds.addAll(additionalArgs(file))
cmds.add(DirHelper.join(project.basePath!!, *parentPath, file.name))
return KratosTask(
{
runAndLog(project, cmds)
Expand Down

0 comments on commit db98d70

Please sign in to comment.