Populated CLI with initial GO

This commit is contained in:
Lucas
2025-12-14 21:01:12 -08:00
parent d491fbd1fe
commit bfcf8d271b
10 changed files with 296 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
package cli
import (
"bufio"
"fmt"
"definitive-opensource/data"
)
func selectPlatforms(scanner *bufio.Scanner) ([]string, error) {
platforms, err := data.LoadPlatforms()
if err != nil {
return nil, err
}
selected := []string{}
for {
fmt.Println("Select platforms (0 to finish):")
for i, p := range platforms {
fmt.Printf("%d) %s\n", i+1, p.Name)
}
var idx int
fmt.Scanln(&idx)
if idx == 0 {
break
}
if idx > 0 && idx <= len(platforms) {
selected = append(selected, platforms[idx-1].ID)
}
}
return selected, nil
}