From fcbbeccaa80c7e120933682b330272a1490c1cf5 Mon Sep 17 00:00:00 2001 From: hachem Date: Sat, 29 Aug 2026 18:24:42 +0200 Subject: refactor: unify mods command with the search --- internal/cli/commands.go | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'internal/cli/commands.go') diff --git a/internal/cli/commands.go b/internal/cli/commands.go index f50036c..d76402d 100644 --- a/internal/cli/commands.go +++ b/internal/cli/commands.go @@ -1,7 +1,6 @@ package cli import ( - "fmt" "strings" tea "github.com/charmbracelet/bubbletea" @@ -13,11 +12,9 @@ import ( func defaultCommands() []command { return []command{ { - name: "list-mods", - desc: "List the configured mods", - run: func(m *model) tea.Cmd { - return tea.Println(renderModList(m.cfg)) - }, + name: "mods", + desc: "Manage mods — list, search, add, pin versions, remove", + run: runMods, }, { name: "check", @@ -76,23 +73,6 @@ func helpBlock(cmds []command) string { return lipgloss.JoinVertical(lipgloss.Left, rows...) } -func renderModList(cfg *config.Config) string { - rows := []string{ - headingStyle.Render(fmt.Sprintf("Mods for MC %s", cfg.MinecraftVersion)), - "", - } - - if len(cfg.ModrinthMods) == 0 { - rows = append(rows, mutedStyle.Render(" (none configured)")) - } - for _, slug := range cfg.ModrinthMods { - rows = append(rows, " "+bulletStyle.Render("◆ ")+slug) - } - - rows = append(rows, "", mutedStyle.Render(fmt.Sprintf("Total: %d mods", len(cfg.ModrinthMods)))) - return lipgloss.JoinVertical(lipgloss.Left, rows...) -} - func padRight(s string, n int) string { if pad := n - len([]rune(s)); pad > 0 { return s + strings.Repeat(" ", pad) -- cgit v1.3