Skip to content

Commit

Permalink
Merge pull request #32 from easysoft/Dev
Browse files Browse the repository at this point in the history
errors in filepath
  • Loading branch information
aaronchen2k authored Dec 13, 2021
2 parents 6dd7daf + 0728da3 commit 4a0ea06
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/action/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ import (

func Generate(files []string, fieldsToExportStr, format, table string) (lines []interface{}) {
startTime := time.Now().Unix()

if len(files) == 0 {
return
}

count := 0
if strings.ToLower(filepath.Ext(files[0])) == "."+constant.FormatProto { //gen from protobuf
buf, pth := gen.GenerateFromProtobuf(files[0])
if strings.ToLower(filepath.Ext(files[1])) == "."+constant.FormatProto { //gen from protobuf
buf, pth := gen.GenerateFromProtobuf(files[1])

if vari.Verbose {
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("protobuf_path", pth))
Expand All @@ -37,7 +36,11 @@ func Generate(files []string, fieldsToExportStr, format, table string) (lines []
logUtils.PrintTo(i118Utils.I118Prt.Sprintf("server_response", count, entTime-startTime))
}
} else { // default gen from yaml
vari.ConfigFileDir = fileUtils.GetAbsDir(files[0])
if files[0] != "" {
vari.ConfigFileDir = fileUtils.GetAbsDir(files[0])
} else {
vari.ConfigFileDir = fileUtils.GetAbsDir(files[1])
}
contents := gen.LoadFilesContents(files)
lines = GenerateByContent(contents, fieldsToExportStr, format, table)
}
Expand Down

0 comments on commit 4a0ea06

Please sign in to comment.