Files
BrowserOS/packages/browseros/tools/patch/cmd/list.go
Nikhil e7105ae50b fix: improve browseros-patch workspace feedback (#921)
* fix: make patch list registry-only

* feat: add patch command progress logs

* fix: address review feedback for PR #921
2026-05-02 15:09:31 -07:00

37 lines
1.0 KiB
Go

package cmd
import (
"fmt"
"github.com/browseros-ai/BrowserOS/packages/browseros/tools/patch/internal/ui"
"github.com/spf13/cobra"
)
func init() {
command := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Annotations: map[string]string{"group": "Workspace:"},
Short: "List registered workspaces",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
if len(appState.Registry.Workspaces) == 0 {
return renderResult(map[string]any{"workspaces": []any{}}, func() {
fmt.Println("No workspaces registered. Run `browseros-patch add <name> <path>`.")
})
}
rows := make([][]string, 0, len(appState.Registry.Workspaces))
for _, ws := range appState.Registry.Workspaces {
rows = append(rows, []string{
ws.Name,
ws.Path,
})
}
return renderResult(map[string]any{"workspaces": appState.Registry.Workspaces}, func() {
fmt.Println(ui.RenderTable([]string{"NAME", "PATH"}, rows))
})
},
}
rootCmd.AddCommand(command)
}