-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"github.com/ctfang/command" | ||
"github.com/go-home-admin/toolset/parser" | ||
"strings" | ||
) | ||
|
||
// GrpcCommand @Bean | ||
type GrpcCommand struct{} | ||
|
||
func (GrpcCommand) Configure() command.Configure { | ||
return command.Configure{ | ||
Name: "make:grpc", | ||
Description: "根据protoc文件定义, 生成路grpc基础文件", | ||
Input: command.Argument{ | ||
Option: []command.ArgParam{ | ||
{ | ||
Name: "path", | ||
Description: "只解析指定目录", | ||
Default: "@root/protobuf/endpoint", | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
// TODO | ||
func (GrpcCommand) Execute(input command.Input) { | ||
root := getRootPath() | ||
module := getModModule() | ||
|
||
_ = module | ||
|
||
path := input.GetOption("path") | ||
path = strings.Replace(path, "@root", root, 1) | ||
|
||
for _, parsers := range parser.NewProtocParserForDir(path) { | ||
for _, fileParser := range parsers { | ||
for _, service := range fileParser.Services { | ||
fmt.Println(service) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters