mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-21 12:55:09 +00:00
fix: make patch list registry-only
This commit is contained in:
@@ -3,7 +3,6 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/browseros-ai/BrowserOS/packages/browseros/tools/patch/internal/engine"
|
||||
"github.com/browseros-ai/BrowserOS/packages/browseros/tools/patch/internal/ui"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -13,7 +12,7 @@ func init() {
|
||||
Use: "list",
|
||||
Aliases: []string{"ls"},
|
||||
Annotations: map[string]string{"group": "Workspace:"},
|
||||
Short: "List registered workspaces and their sync state",
|
||||
Short: "List registered workspaces",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(appState.Registry.Workspaces) == 0 {
|
||||
@@ -21,27 +20,15 @@ func init() {
|
||||
fmt.Println("No workspaces registered. Run `browseros-patch add <name> <path>`.")
|
||||
})
|
||||
}
|
||||
info, err := repoInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rows := make([][]string, 0, len(appState.Registry.Workspaces))
|
||||
statuses := make([]*engine.WorkspaceStatus, 0, len(appState.Registry.Workspaces))
|
||||
for _, ws := range appState.Registry.Workspaces {
|
||||
status, err := engine.InspectWorkspace(cmd.Context(), ws, info)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
statuses = append(statuses, status)
|
||||
rows = append(rows, []string{
|
||||
ws.Name,
|
||||
status.SyncState,
|
||||
fmt.Sprintf("%d/%d/%d", len(status.UpToDate), len(status.NeedsUpdate), len(status.Orphaned)),
|
||||
ws.Path,
|
||||
})
|
||||
}
|
||||
return renderResult(map[string]any{"workspaces": statuses}, func() {
|
||||
fmt.Println(ui.RenderTable([]string{"NAME", "STATE", "PATCHES", "PATH"}, rows))
|
||||
return renderResult(map[string]any{"workspaces": appState.Registry.Workspaces}, func() {
|
||||
fmt.Println(ui.RenderTable([]string{"NAME", "PATH"}, rows))
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user