Skip to content

Commit

Permalink
feat: show generated result
Browse files Browse the repository at this point in the history
close #8
  • Loading branch information
wolfogre committed May 9, 2020
1 parent 9fc66cb commit bb480e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/gtag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ func main() {
tags = strings.Split(*Tags, ",")
}

_, err := gtag.Generate(context.Background(), dir, types, tags)
result, err := gtag.Generate(context.Background(), dir, types, tags)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

for _, v := range result {
fmt.Printf("generated %s -> %s\n", v.Source, v.Output)
}
}

func printUsages() {
Expand Down
2 changes: 2 additions & 0 deletions internal/gtag/gtag.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

type GenerateResult struct {
Content []byte
Source string
Output string
}

Expand Down Expand Up @@ -115,6 +116,7 @@ func generateFile(ctx context.Context, cmd, file string, types []string, tags []

ret := &GenerateResult{
Content: src,
Source: file,
Output: strings.TrimSuffix(file, ".go") + "_tag.go",
}

Expand Down

0 comments on commit bb480e0

Please sign in to comment.