make sure taks are in order and interfaces random

This commit is contained in:
Robin Olsen
2026-03-11 12:18:17 +01:00
parent 2c90566260
commit f2413b68f5
2 changed files with 16 additions and 14 deletions

View File

@@ -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]]