make sure taks are in order and interfaces random
This commit is contained in:
@@ -137,16 +137,14 @@ func runStartCmd(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
func taskLoop(ctx context.Context, application *task.App, surveyTasks map[string]task.Tasker, interfaces map[string]task.Interface) error {
|
||||
var iNames []string
|
||||
for name := range interfaces {
|
||||
iNames = append(iNames, name)
|
||||
}
|
||||
iNames := task.ListInterfaces()
|
||||
|
||||
if len(iNames) == 0 {
|
||||
return fmt.Errorf("no interfaces are available")
|
||||
}
|
||||
|
||||
if len(surveyTasks) == 0 {
|
||||
taskNames := task.ListTasks()
|
||||
if len(taskNames) == 0 {
|
||||
return fmt.Errorf("no tasks are available")
|
||||
}
|
||||
|
||||
@@ -155,7 +153,11 @@ func taskLoop(ctx context.Context, application *task.App, surveyTasks map[string
|
||||
})
|
||||
|
||||
idx := 0
|
||||
for _, t := range surveyTasks {
|
||||
for _, taskName := range taskNames {
|
||||
t, ok := surveyTasks[taskName]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
iIdx := idx % len(iNames)
|
||||
selected := interfaces[iNames[iIdx]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user