Skip to content

Commit

Permalink
Merge pull request #2 from jjackson-s/feature
Browse files Browse the repository at this point in the history
Merging previous PR
  • Loading branch information
jjackson-s authored Jun 29, 2021
2 parents c39c3b7 + 8a261fb commit 479fe05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
15 changes: 4 additions & 11 deletions cmd/configschema/configwiz/configwiz/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,8 @@ func handleComponent(
) {
typeMap := map[string]interface{}{}
m[componentGroup+"s"] = typeMap
var err error
var cfgInfo configschema.CfgInfo
for _, name := range names {
if strings.Contains(name, "/") {
compName := strings.Split(name, "/")[0]
cfgInfo, err = configschema.GetCfgInfo(factories, componentGroup, compName)
} else {
cfgInfo, err = configschema.GetCfgInfo(factories, componentGroup, name)
}
cfgInfo, err := configschema.GetCfgInfo(factories, componentGroup, strings.Split(name, "/")[0])
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -97,11 +90,11 @@ func handleField(p indentingPrinter, field *configschema.Field, out map[string]i
p.println("Field: " + field.Name)
typ := resolveType(field)
if typ != "" {
p.print("Type: " + typ)
typString := "Type: " + typ
if typ == "time.Duration" {
fmt.Print(" (examples: 1h2m3s, 5m10s, 45s)")
typString += " (examples: 1h2m3s, 5m10s, 45s)"
}
p.print("\n")
p.println(typString)
}
if field.Doc != "" {
p.println("Docs: " + strings.ReplaceAll(field.Doc, "\n", " "))
Expand Down
6 changes: 3 additions & 3 deletions cmd/configschema/configwiz/configwiz/pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"go.opentelemetry.io/collector/component/componenterror"
)

const invalid string = "Invalid input. Try again."
const invalidMsg = "Invalid input. Try again."

func pipelinesWizard(factories component.Factories) map[string]interface{} {
out := map[string]interface{}{}
Expand Down Expand Up @@ -64,7 +64,7 @@ func singlePipelineWizard(factories component.Factories) (string, rpe) {
case "2":
return pipelineTypeWizard("traces", receiverNames(factories, isTracesReceiver), processorNames(factories, isTracesProcessor), exporterNames(factories, isTracesExporter))
}
fmt.Println(invalid)
fmt.Println(invalidMsg)
return singlePipelineWizard(factories)
}

Expand Down Expand Up @@ -128,7 +128,7 @@ func componentNameWizard(pr indentingPrinter, componentType string, componentNam
}
i, _ := strconv.Atoi(choice)
if i < 0 || i > len(componentNames)-1 {
fmt.Println(invalid)
fmt.Println(invalidMsg)
return componentNameWizard(pr, componentType, componentNames)
}
key := componentNames[i]
Expand Down

0 comments on commit 479fe05

Please sign in to comment.