Moved cli and web directory into app dir

This commit is contained in:
Lucas
2026-01-02 12:27:03 -08:00
parent c9f5feb9cb
commit 3fba4355fe
12 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package cli
import (
"bufio"
"fmt"
"strings"
"definitive-opencore/data"
)
func selectCategory(scanner *bufio.Scanner) (string, error) {
subs, err := data.LoadSubcategories()
if err != nil {
return "", err
}
for {
fmt.Print("Search category: ")
scanner.Scan()
query := strings.ToLower(scanner.Text())
filtered := []string{}
for _, s := range subs {
if strings.Contains(strings.ToLower(s.Name), query) {
filtered = append(filtered, fmt.Sprintf("%s (%s)", s.Name, s.ID))
}
}
for i, f := range filtered {
fmt.Printf("%d) %s\n", i+1, f)
}
fmt.Print("Select category number: ")
var idx int
fmt.Scanln(&idx)
if idx > 0 && idx <= len(filtered) {
return subs[idx-1].ID, nil
}
fmt.Println("Invalid selection, try again")
}
}