@@ -25,6 +25,8 @@ import (
25
25
"go.opentelemetry.io/collector/component/componenterror"
26
26
)
27
27
28
+ const invalidMsg = "Invalid input. Try again."
29
+
28
30
func pipelinesWizard (factories component.Factories ) map [string ]interface {} {
29
31
out := map [string ]interface {}{}
30
32
for {
@@ -55,12 +57,15 @@ func singlePipelineWizard(factories component.Factories) (string, rpe) {
55
57
fmt .Print ("> " )
56
58
pipelineID := readline ("" )
57
59
switch pipelineID {
60
+ case "" :
61
+ return "" , rpe {}
58
62
case "1" :
59
63
return pipelineTypeWizard ("metrics" , receiverNames (factories , isMetricsReceiver ), exporterNames (factories , isMetricsExporter ))
60
64
case "2" :
61
65
return pipelineTypeWizard ("traces" , receiverNames (factories , isTracesReceiver ), exporterNames (factories , isTracesExporter ))
62
66
}
63
- return "" , rpe {}
67
+ fmt .Println (invalidMsg )
68
+ return singlePipelineWizard (factories )
64
69
}
65
70
66
71
// pipelineTypeWizard for a given pipelineType (e.g. "metrics", "traces")
@@ -120,6 +125,10 @@ func componentNameWizard(pr indentingPrinter, componentType string, componentNam
120
125
return "" , ""
121
126
}
122
127
i , _ := strconv .Atoi (choice )
128
+ if i < 0 || i > len (componentNames )- 1 {
129
+ fmt .Println (invalidMsg )
130
+ return componentNameWizard (pr , componentType , componentNames )
131
+ }
123
132
key := componentNames [i ]
124
133
pr .print (fmt .Sprintf ("%s %s extended name (optional) > " , key , componentType ))
125
134
return key , readline ("" )
0 commit comments