hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/commands.go
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-29 18:24:42 +0200
committerhachem <im@hachem.wtf>2026-08-29 18:24:42 +0200
commitfcbbeccaa80c7e120933682b330272a1490c1cf5 (patch)
tree11de4610f01a3861f7bbea94da63dd2d070f420a /internal/cli/commands.go
parent4806ee7ef95f0f04079856f7753399b7b7aa6330 (diff)
refactor: unify mods command with the search
Diffstat (limited to 'internal/cli/commands.go')
-rw-r--r--internal/cli/commands.go26
1 files changed, 3 insertions, 23 deletions
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)