Files
BrowserOS/packages/browseros/tools/patch/cmd/status.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

50 lines
1.6 KiB
Go

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"
)
func init() {
var src string
command := &cobra.Command{
Use: "status [workspace]",
Annotations: map[string]string{"group": "Core:"},
Short: "Show workspace sync state",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ws, err := resolveWorkspace(args, src)
if err != nil {
return err
}
info, err := repoInfo()
if err != nil {
return err
}
status, err := engine.InspectWorkspace(cmd.Context(), engine.InspectWorkspaceOptions{
Workspace: ws,
Repo: info,
Progress: commandProgress(cmd),
})
if err != nil {
return err
}
return renderResult(status, func() {
fmt.Println(ui.Title(fmt.Sprintf("%s (%s)", ws.Name, status.SyncState)))
fmt.Printf("%s %s\n", ui.Muted("path:"), ws.Path)
fmt.Printf("%s %s\n", ui.Muted("repo head:"), status.RepoHead)
fmt.Printf("%s %s\n", ui.Muted("last sync:"), status.LastSyncRev)
fmt.Printf("%s %s\n", ui.Muted("last apply:"), status.LastApplyRev)
fmt.Printf("%s %d\n", ui.Muted("needs apply:"), len(status.NeedsApply))
fmt.Printf("%s %d\n", ui.Muted("needs update:"), len(status.NeedsUpdate))
fmt.Printf("%s %d\n", ui.Muted("orphaned:"), len(status.Orphaned))
})
},
}
command.Flags().StringVar(&src, "src", "", "Chromium checkout path to operate on directly")
rootCmd.AddCommand(command)
}