add parameter file-mode for templates that wish to parse at a file level instead of each service
This commit is contained in:
parent
c6eca2356c
commit
1d71729a7c
20
main.go
20
main.go
@ -48,6 +48,7 @@ func main() {
|
||||
debug = false
|
||||
all = false
|
||||
singlePackageMode = false
|
||||
fileMode = false
|
||||
)
|
||||
if parameter := g.Request.GetParameter(); parameter != "" {
|
||||
for _, param := range strings.Split(parameter, ",") {
|
||||
@ -85,6 +86,14 @@ func main() {
|
||||
default:
|
||||
log.Printf("Err: invalid value for debug: %q", parts[1])
|
||||
}
|
||||
case "file-mode":
|
||||
switch strings.ToLower(parts[1]) {
|
||||
case boolTrue, "t":
|
||||
fileMode = true
|
||||
case boolFalse, "f":
|
||||
default:
|
||||
log.Printf("Err: invalid value for file-mode: %q", parts[1])
|
||||
}
|
||||
default:
|
||||
log.Printf("Err: unknown parameter: %q", param)
|
||||
}
|
||||
@ -125,6 +134,17 @@ func main() {
|
||||
continue
|
||||
}
|
||||
|
||||
if fileMode {
|
||||
if s := file.GetService(); s != nil && len(s) > 0{
|
||||
encoder := NewGenericTemplateBasedEncoder(templateDir, file, debug, destinationDir)
|
||||
for _, tmpl := range encoder.Files() {
|
||||
concatOrAppend(tmpl)
|
||||
}
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
for _, service := range file.GetService() {
|
||||
encoder := NewGenericServiceTemplateBasedEncoder(templateDir, service, file, debug, destinationDir)
|
||||
for _, tmpl := range encoder.Files() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user